Jump to content

WinCap


Radsam
 Share

Recommended Posts

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... :)

#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

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... :D

#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

<{POST_SNAPBACK}>

Hi great job thx you :)

works good :D

Edited by DirtyBanditos
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...