capture d'ecran automatique
capture d'ecran automatique
Qui saurait me dire quel morceau de code mettre dans un programme pour simuler l'appuie de la touche "IMPR ECRAN" afin de copier l'image a l'ecran dans le tampon pour le retransferer plus tard avec "coller" dans un logiciel de dessin ??
Voici un code qui te permet simuler la touche Impr écran :
J'espère que c'est ce que tu cherches.
Code : Tout sélectionner
; English forum: http://purebasic.myforums.net/viewtopic.php?t=3695&highlight=
; Author: PB
; Date: 30. January 2002
#Desk = #True ; set to #True, if you want screenshot of full desktop
; set to #False, if you want only capture active window
If #Desk = #True ; make screenshot of full desktop
keybd_event_(#VK_SNAPSHOT,0,0,0) ; Snapshot of entire desktop
; Note: Win 9x needs 1,0,0 for the entire desktop.
Else ; make screenshot of active window
keybd_event_(#VK_SNAPSHOT,1,0,0) ; Snapshot of current active window.
EndIf
MessageRequester("Message","OK, paste the current clipboard data to your favorite Gfx program to see screenshot.",#MB_ICONEXCLAMATION)
-
- Messages : 1092
- Inscription : mer. 28/janv./2004 16:22
- Localisation : 76
- Contact :
Code : Tout sélectionner
i = 0
Repeat
Delay(1)
If GetAsyncKeyState_(#VK_SNAPSHOT) = -32767
If ExamineDesktops()
Ecran_Largeur = DesktopWidth(0)
Ecran_Hauteur = DesktopHeight(0)
ProfondeurCouleur = DesktopDepth(0)
Else
End
EndIf
DC = GetDC_(0)
CreateImage(0, Ecran_Largeur, Ecran_Hauteur)
Dessin = StartDrawing(ImageOutput())
BitBlt_(Dessin, 0, 0, Ecran_Largeur, Ecran_Hauteur, DC, 0, 0, #SRCPAINT | $40000000)
StopDrawing()
ReleaseDC_(0, DC)
SaveImage(0, "D:\Screen"+Str(i)+".bmp", #PB_ImagePlugin_BMP)
i = i + 1
EndIf
ForEver
Heis Spiter, webmaster du site http://www.heisspiter.net
Développeur principal et administrateur du projet Bird Chat
Parti courir au bonheur du dév. public et GPL
Développeur principal et administrateur du projet Bird Chat
Parti courir au bonheur du dév. public et GPL
