cs_lo4
Messages postés33Date d'inscriptionvendredi 1 février 2002StatutMembreDernière intervention 7 mai 2007
-
21 sept. 2005 à 14:17
cs_lo4
Messages postés33Date d'inscriptionvendredi 1 février 2002StatutMembreDernière intervention 7 mai 2007
-
22 sept. 2005 à 10:27
Bonjour,
J'ai fait un gestionnaire de tâches en vb.net et je voudais avoir l'apercu de la fenêtre quand on clique sur la ligne correspondante dans le tableau contenant la liste des fenêtres. Comment faire ?
cs_lo4
Messages postés33Date d'inscriptionvendredi 1 février 2002StatutMembreDernière intervention 7 mai 2007 22 sept. 2005 à 10:27
Merci beaucoup pour cette réponse qui m'a été très utile.
En fait, le gestionnaire de tâches n'est qu'une partie de mon programme
qui fera beaucoup plus de choses une fois qu'il sera finitmais
j'essaierai d'y penser à te faire signe une fois qu'il sera terminé .
Voici les lignes de code à mettre dans le projet pour obtenir l'apercu d'une fenêtre connaissant son handle :
Public Structure RECT
Public Left_renommé As Int32
Public Top As Int32
Public Right_renommé As Int32
Public Bottom As Int32
End Structure
<hr size="2" width="100%"> Public Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Int32, ByRef lpRect As RECT) As Int32
<hr size="2" width="100%"> Public Declare Function PrintWindow Lib "user32" (ByVal hwnd As IntPtr, ByVal hDC As IntPtr, ByVal nFlags As UInteger) As IntPtr
<hr size="2" width="100%"> Private Function CaptureWindowPrint(ByVal hWnd As IntPtr, ByVal targetWidth As Integer, ByVal targetHeight As Integer) As Bitmap
Dim memoryImage As Bitmap = New Bitmap(targetWidth, targetHeight)
Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage)
Dim hDC As IntPtr = memoryGraphics.GetHdc()
PrintWindow(hWnd, hDC, 0)
memoryGraphics.ReleaseHdc()
memoryGraphics.Dispose()
Return memoryImage
End Function
<hr size="2" width="100%"> Private Function CaptureWindowPrint(ByVal hWnd As IntPtr) As Bitmap