Radsam Posted March 9, 2005 Share Posted March 9, 2005 Hi, Here is an tool I created out of need to capture error messages and store them quickly. You must have Lazycats "captdll.dll" in the system32 folder. WinCap will list all active windows. All you have to do is select the window you wish to capture and click the bottom button. The image will be saved in My Documents with the filename in the following format: MM.DD.YYYY - HH.MM.SS.bmp Special thanks to Lazycat for his captdll.dll. Hope it is useful to someone... expandcollapse popup#include <GUIConstants.au3> GUICreate("WinCap - Select Window to Capture",600, 420) $cFile = GUICtrlCreateMenu ("&File") $cExit = GUICtrlCreateMenuitem ("E&xit",$cFile) $cHelp = GUICtrlCreateMenu ("&Help") $cHelpTopics = GUICtrlCreateMenuitem ("Help &Topics",$cHelp) GUICtrlCreateMenuitem ("",$cHelp) $cAbout = GUICtrlCreateMenuitem ("&About",$cHelp) $var = WinList() $list = GUICtrlCreatelist("",0,0,600,350) Dim $sFileName $cActivate = GUICtrlCreateButton ("Capture", 10, 345, 580, 45, $BS_ICON) GUICtrlSetImage (-1, "shell32.dll",139) Dim $x = -1 For $i = 1 to $var[0][0] If $var[$i][0] = "" Then ContinueLoop If IsVisible($var[$i][1]) Then $x = $x + 1 GUICtrlSetData($list,$var[$i][0] & "|") EndIf Next GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE or $msg = $cExit Exitloop Case $msg = $cActivate $sFileName = @MON & "." & @MDAY & "." & @YEAR & " - " & @HOUR & "." & @MIN & "." & @SEC $win = GUICtrlRead($list) _CaptureActiveWindow() MsgBox(0, "WinCap", $win & @LF & "has been captured and saved in" & @LF & @MyDocumentsDir & "\" & $sFileName & ".bmp") Case $msg = $cAbout MsgBox(262144,"About WinCap","" & @CRLF & "WinCap" & @CRLF & "Version: 1.0.0.0" & @CRLF & "Copyright: Open Source" & @CRLF & "Contributors: Radsam" & @CRLF & "") Case $msg = $cHelpTopics MsgBox(262208,"Help Topics","Purpose: To take screen or window shots." & @CRLF & "Use: Select the window title you wish to take a shot of and click the camera button at the bottom. If you wish to take a shot of entire screen, select Program Manager from the list." & @CRLF & "Output: All shots are saved as bmp files in My Documents. The file name is a date/time format." & @CRLF & " eg: MM.DD.YYYY - HH.MM.SS.bmp") EndSelect WEnd Exit Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Func _CaptureActiveWindow() $wlist = GUICtrlRead($list) WinActivate($wlist) $wRect = WinGetPos($wlist) DllCall("captdll.dll", "int", "CaptureRegion", "str", @MyDocumentsDir & "\" & $sFileName & ".bmp", "int", $wRect[0], "int", $wRect[1], "int", $wRect[2], "int", $wRect[3], "int", -1) Return EndFunc Radsam Link to comment Share on other sites More sharing options...
DirtyBanditos Posted March 10, 2005 Share Posted March 10, 2005 (edited) Hi,Here is an tool I created out of need to capture error messages and store them quickly. You must have Lazycats "captdll.dll" in the system32 folder. WinCap will list all active windows. All you have to do is select the window you wish to capture and click the bottom button. The image will be saved in My Documents with the filename in the following format: MM.DD.YYYY - HH.MM.SS.bmpSpecial thanks to Lazycat for his captdll.dll.Hope it is useful to someone... expandcollapse popup#include <GUIConstants.au3> GUICreate("WinCap - Select Window to Capture",600, 420) $cFile = GUICtrlCreateMenu ("&File") $cExit = GUICtrlCreateMenuitem ("E&xit",$cFile) $cHelp = GUICtrlCreateMenu ("&Help") $cHelpTopics = GUICtrlCreateMenuitem ("Help &Topics",$cHelp) GUICtrlCreateMenuitem ("",$cHelp) $cAbout = GUICtrlCreateMenuitem ("&About",$cHelp) $var = WinList() $list = GUICtrlCreatelist("",0,0,600,350) Dim $sFileName $cActivate = GUICtrlCreateButton ("Capture", 10, 345, 580, 45, $BS_ICON) GUICtrlSetImage (-1, "shell32.dll",139) Dim $x = -1 For $i = 1 to $var[0][0] If $var[$i][0] = "" Then ContinueLoop If IsVisible($var[$i][1]) Then $x = $x + 1 GUICtrlSetData($list,$var[$i][0] & "|") EndIf Next GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE or $msg = $cExit Exitloop Case $msg = $cActivate $sFileName = @MON & "." & @MDAY & "." & @YEAR & " - " & @HOUR & "." & @MIN & "." & @SEC $win = GUICtrlRead($list) _CaptureActiveWindow() MsgBox(0, "WinCap", $win & @LF & "has been captured and saved in" & @LF & @MyDocumentsDir & "\" & $sFileName & ".bmp") Case $msg = $cAbout MsgBox(262144,"About WinCap","" & @CRLF & "WinCap" & @CRLF & "Version: 1.0.0.0" & @CRLF & "Copyright: Open Source" & @CRLF & "Contributors: Radsam" & @CRLF & "") Case $msg = $cHelpTopics MsgBox(262208,"Help Topics","Purpose: To take screen or window shots." & @CRLF & "Use: Select the window title you wish to take a shot of and click the camera button at the bottom. If you wish to take a shot of entire screen, select Program Manager from the list." & @CRLF & "Output: All shots are saved as bmp files in My Documents. The file name is a date/time format." & @CRLF & " eg: MM.DD.YYYY - HH.MM.SS.bmp") EndSelect WEnd Exit Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Func _CaptureActiveWindow() $wlist = GUICtrlRead($list) WinActivate($wlist) $wRect = WinGetPos($wlist) DllCall("captdll.dll", "int", "CaptureRegion", "str", @MyDocumentsDir & "\" & $sFileName & ".bmp", "int", $wRect[0], "int", $wRect[1], "int", $wRect[2], "int", $wRect[3], "int", -1) Return EndFuncRadsam<{POST_SNAPBACK}>Hi great job thx you works good Edited March 10, 2005 by DirtyBanditos Link to comment Share on other sites More sharing options...
Ontosy Posted March 11, 2005 Share Posted March 11, 2005 How to find: Lazycat for his captdll.dll ? Link to comment Share on other sites More sharing options...
Lazycat Posted March 11, 2005 Share Posted March 11, 2005 Simple. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now