Pour cette exemple, Je souhaite capturer le bureau de window.
■ Ce code sans procédure fonctionne
Code : Tout sélectionner
;Préparation du prototype générant la fonction "PrintWindow"
Prototype.i ptPrintWindow(hWnd, hdc, flags)
OpenLibrary(1, "User32.dll")
PrintWindow.ptPrintWindow = GetFunction(1, "PrintWindow")
;Dimension du desktop
ExamineDesktops()
Width + DesktopWidth(0)
Height + DesktopHeight(0)
;Quel est le handle du Desktop
hWnd = FindWindow_(0,"Program Manager")
;Capture du Desktop
Image = CreateImage(#PB_Any, Width, height, 24)
Result = StartDrawing(ImageOutput(Image))
Delay(10)
PrintWindow(hWnd, Result, 0)
StopDrawing()
ShowLibraryViewer("Image", Image)
CallDebugger
■ Par contre si je veux utiliser une procédure la fonction déclarée dans mon prototype devient inexistante.
Code : Tout sélectionner
;Préparation du prototype générant la fonction "PrintWindow"
Prototype.i ptPrintWindow(hWnd, hdc, flags)
OpenLibrary(1, "User32.dll")
PrintWindow.ptPrintWindow = GetFunction(1, "PrintWindow")
Procedure Capture()
;Dimension du desktop
ExamineDesktops()
Width + DesktopWidth(0)
Height + DesktopHeight(0)
;Quel est le handle du Desktop
hWnd = FindWindow_(0,"Program Manager")
;Capture du Desktop
Image = CreateImage(#PB_Any, Width, height, 24)
Result = StartDrawing(ImageOutput(Image))
Delay(10)
PrintWindow(hWnd, Result, 0)
StopDrawing()
EndProcedure
Capture()
ShowLibraryViewer("Image", Image)
CallDebugger
