Capture Any Browser [Windows]
Posted: Mon Apr 08, 2013 9:28 pm
Tested with IE8, Firefox 19.1 & Opera
Windows XP x86,Win 7 x64
Support multiple images in one session
The captured images in your Home Folder
Other browsers can be added
Edit :Code Modified
Windows XP x86,Win 7 x64
Support multiple images in one session
The captured images in your Home Folder
Other browsers can be added
Code: Select all
Prototype printwindow(hwnd,hdc,flag)
Global printwindow.printwindow,Class$
lib = OpenLibrary(0,"User32.dll")
If lib
printwindow = GetFunction(0,"PrintWindow")
EndIf
Procedure GetHandle()
hWnd = GetWindow_(GetDesktopWindow_(),#GW_CHILD)
Repeat
Class$ = Space(#MAX_PATH)
GetClassName_(hWnd,@Class$,#MAX_PATH)
If (Class$ = "IEFrame" Or Class$ = "MozillaWindowClass" Or Class$ = "OperaWindowClass") And IsWindowVisible_(hWnd) = 1
Finhwnd = hWnd
Else
hWnd = GetWindow_(hWnd,#GW_HWNDNEXT)
EndIf
Until hWnd=0 Or Finhwnd <> 0
ProcedureReturn Finhwnd
EndProcedure
OpenWindow(0,0,0,300,200,"Capture Any Browser",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ButtonGadget(0,10,160,60,30,"Capture")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
If lib
CloseLibrary(0)
EndIf
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 0
hWnd = GetHandle()
If hWnd
If IsIconic_(hWnd)
ShowWindow_(hWnd,#SW_RESTORE)
Flag =1
EndIf
GetWindowRect_(hWnd,r.RECT)
hBitmap = CreateImage(0,r\right-r\left,r\bottom-r\top)
hdc = StartDrawing(ImageOutput(0))
PrintWindow(hwnd,hdc,0)
StopDrawing()
DeleteDC_(hdc)
Delay(200)
SaveImage(0,GetHomeDirectory() + Class$+" "+Str(n)+".bmp",#PB_ImagePlugin_BMP)
n+1
If Flag = 1
ShowWindow_(hWnd,#SW_MINIMIZE )
EndIf
EndIf
EndSelect
EndSelect
Until Quit = 1
End