samisahliess
Messages postés19Date d'inscriptionmercredi 18 mai 2005StatutMembreDernière intervention 7 septembre 2005
-
23 août 2005 à 19:29
PCPT
Messages postés13272Date d'inscriptionlundi 13 décembre 2004StatutMembreDernière intervention 3 février 2018
-
24 août 2005 à 04:22
s'il vous plais je veux creer un bouton qui me permet de faire un imprime ecran de la forme c tres tres urgent merci
violent_ken
Messages postés1812Date d'inscriptionmardi 31 mai 2005StatutMembreDernière intervention26 octobre 20102 23 août 2005 à 20:34
Salut !
Le code ci dessous permet de sauvegarder la capture d'écran en "c:\screen.bmp"
Le code nécessite une picturebox (picture1)
Mets çà dans une form :
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Function BitBlt Lib "gdi32.dll" ( _
ByVal hDestDC As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal dwRop As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32.dll" () As Long
Private Declare Function GetDC Lib "user32.dll" ( _
ByVal hwnd As Long) As Long
Private Const SRCCOPY As Long = &HCC0020
Public Sub shot()
Dim path As String
path = "c:\screen.bmp"
Picture1.AutoRedraw = True
Picture1.Width = Screen.Width
Picture1.Height = Screen.Height
BitBlt Picture1.hDC, 0&, 0&, Screen.Width, Screen.Height, GetDC(GetDesktopWindow()), 0&, 0&, SRCCOPY
SavePicture Picture1.Image, path
End Sub
et quand tu clique sur ton bouton, tu mets
private sub command1_click()
shot
end sub