FrancescoDiMuro Posted May 9, 2018 Share Posted May 9, 2018 (edited) Good morning everyone I was playing a little bit with "Screen Capture" UDF, and I was trying to make a "Window" capture, but, since I made a GUI which through I fire the event "Capture", my GUI is captured as well, and I don't want to This is the line of code that makes the capture: _ScreenCapture_CaptureWnd($strScreenCaptureFileName, $objActiveWindow, 0, 0, -1, -1, False) And these are the lines of code which select the "active" window: Local $objCurrentWindow = 9999 If _IsPressed("01") Then $objCurrentWindow = WinGetHandle("[ACTIVE]") If $objCurrentWindow <> $objMyGUI Then $objActiveWindow = $objCurrentWindow EndIf EndIf Sorry If I made stupid mistakes Thanks in advance. Francesco Edited May 11, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
mikell Posted May 9, 2018 Share Posted May 9, 2018 7 hours ago, FrancescoDiMuro said: I made a GUI which through I fire the event "Capture" Which way does this gui work ? do you press a button ? Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 10, 2018 Author Share Posted May 10, 2018 Good morning @mikell Yes, I just have a file menu and a button on this GUI ( which takes the picture ) Thanks for the reply Best Regards. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
mikell Posted May 10, 2018 Share Posted May 10, 2018 So you're coming into trouble, because pressing the button makes your gui the current active window Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 10, 2018 Author Share Posted May 10, 2018 @mikell Not really The code Local $objCurrentWindow = 9999 If _IsPressed("01") Then $objCurrentWindow = WinGetHandle("[ACTIVE]") If $objCurrentWindow <> $objMyGUI Then $objActiveWindow = $objCurrentWindow EndIf EndIf avoid this, but, when I have my GUI in the same "section" of the screenshot, it is included in the screenshot If I put my GUI on my second screen, the screenshot doesn't have my GUI in it PS: I see this code from a @Melba23 post Thank you Sir! Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
mikell Posted May 10, 2018 Share Posted May 10, 2018 So the only workaround I can think of would be : hide the gui, take the picture, show the gui Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 11, 2018 Author Share Posted May 11, 2018 15 hours ago, mikell said: So the only workaround I can think of would be : hide the gui, take the picture, show the gui Already tried! Seems to not work Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
mikell Posted May 11, 2018 Share Posted May 11, 2018 Hmmm this works for me #include <ScreenCapture.au3> #include <GUIConstantsEx.au3> $hGUI = GUICreate("Screen Capture") $btn = GUICtrlCreateButton("test", 120, 170, 85, 25) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $btn GUISetState(@SW_HIDE) $objCurrentWindow = WinGetHandle("[ACTIVE]") _ScreenCapture_CaptureWnd(@desktopDir & "\GDIPlus_Image.jpg", $objCurrentWindow) GUISetState(@SW_SHOW) EndSwitch WEnd Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 11, 2018 Author Share Posted May 11, 2018 @mikell Using On 9/5/2018 at 12:02 PM, FrancescoDiMuro said: _ScreenCapture_CaptureWnd($strScreenCaptureFileName, $objActiveWindow, 0, 0, -1, -1, False) instead of 31 minutes ago, mikell said: _ScreenCapture_CaptureWnd(@desktopDir & "\GDIPlus_Image.jpg", $objCurrentWindow) causes the "error". I removed all the "extra" parameters, and now it works perfectly. Thanks for your help Best Regards. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette 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