TheXman Posted February 4, 2018 Posted February 4, 2018 (edited) The _ScreenCapture_CaptureWnd() logic may have an issue in v3.3.14.3. I was testing scripts using v3.3.14.3 and saw that the scripts' screen captures weren't getting created. I immediately ran the scripts using v3.3.14.2 and the screen captures were being created as expected. The _ScreenCapture_CaptureWnd() function, in v3.3.14.3, returns @error = -2. Can anyone else confirm that they are seeing the same issue? Below is a slightly modified version of the function's help file's _ScreenCapture_CaptureWnd() example that should allow you to recreate the issue. #include <Constants.au3> #include <ScreenCapture.au3> Example() Func Example() Local $hGUI ; Create GUI $hGUI = GUICreate("Screen Capture", 400, 300) GUISetState(@SW_SHOW) Sleep(250) ; Capture window _ScreenCapture_CaptureWnd(@TempDir & "\GDIPlus_Image.jpg", $hGUI) If @error Then MsgBox($MB_ICONERROR, "", _ "_ScreenCapture_CaptureWnd() failed." & @CRLF & @CRLF & _ "@error = " & @error _ ) Exit 1 EndIf ShellExecute(@TempDir & "\GDIPlus_Image.jpg") EndFunc ;==>Example Edited February 4, 2018 by TheXman Corrected the @error code from 2 to -2 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Moderators Melba23 Posted February 4, 2018 Moderators Posted February 4, 2018 TheXman, I have found the cause of the error - deep in the GDIPlus library - and I know how to fix it. But before I do, I need to talk to the GDI gurus to see if changing this single line will impact anything else in the library. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
TheXman Posted February 4, 2018 Author Posted February 4, 2018 Thanks Melba23! CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Moderators Melba23 Posted February 4, 2018 Moderators Posted February 4, 2018 The XMan, The culprit actually appears to be the the _WinAPI_WideCharToMultiByte function, so the problem might be wider than just the GDIPlus library and many thanks for the bug report which has highlighted this problem. We are now investigating why this function no longer returns what other dependent functions are obviously expecting. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
TheXman Posted February 6, 2018 Author Posted February 6, 2018 @Melba23, Has there been any progress in resolving the root cause of this issue? Will the notification of a fix be posted back here, to the sticky post related to 3.3.14.3 fixes, or somewhere else? I've been holding off on doing any further testing of 3.3.14.3 since what you believe to be the issue is such a low-level issue and may have wider ramifications. Thanks, TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Moderators Melba23 Posted February 6, 2018 Moderators Posted February 6, 2018 TheXman, We have some working code and I will post the amended WinAPIConv library soon in the "3.3.14.3. Fixes" thread. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
TheXman Posted February 6, 2018 Author Posted February 6, 2018 Thank so much! CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Imp Posted February 8, 2018 Posted February 8, 2018 Current version Func _WinAPI_WideCharToMultiByte($vUnicode, $iCodePage = 0, $bRetString = True) ; some code Local $tMultiByte = DllStructCreate("byte[" & $aResult[0] & "]") ; some code EndFunc ;==>_WinAPI_WideCharToMultiByte Must be changed to Func _WinAPI_WideCharToMultiByte($vUnicode, $iCodePage = 0, $bRetString = True) ; some code Local $tMultiByte = DllStructCreate("char[" & $aResult[0] & "]") ; some code EndFunc ;==>_WinAPI_WideCharToMultiByte because it returns Binary, not String as documented.
Moderators Melba23 Posted February 8, 2018 Moderators Posted February 8, 2018 Hi, Fixed here: M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Imp Posted February 8, 2018 Posted February 8, 2018 Also GDIPlus.au3 contains some unecessary string conversions in _GDIPlus_GetEncoders and _GDIPlus_GetDecoders. To correct it: 1. Remove #include "WinAPIConv.au3" from top of GDIPlus.au3. This is no longer needed. 2. Replace _GDIPlus_GetEncoders with the following: Func _GDIPlus_Encoders() Local $iCount = _GDIPlus_EncodersGetCount() Local $iSize = _GDIPlus_EncodersGetSize() Local $tBuffer = DllStructCreate("byte[" & $iSize & "]") Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetImageEncoders", "uint", $iCount, "uint", $iSize, "struct*", $tBuffer) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Local $pBuffer = DllStructGetPtr($tBuffer) Local $tCodec, $aInfo[$iCount + 1][14] $aInfo[0][0] = $iCount For $iI = 1 To $iCount $tCodec = DllStructCreate($tagGDIPIMAGECODECINFO, $pBuffer) $aInfo[$iI][1] = _WinAPI_StringFromGUID(DllStructGetPtr($tCodec, "CLSID")) $aInfo[$iI][2] = _WinAPI_StringFromGUID(DllStructGetPtr($tCodec, "FormatID")) $aInfo[$iI][3] = DllStructGetData( DllStructCreate( "wchar[128]", DllStructGetData($tCodec, "CodecName")), 1 ) $aInfo[$iI][4] = DllStructGetData( DllStructCreate( "wchar[128]", DllStructGetData($tCodec, "DllName")), 1 ) $aInfo[$iI][5] = DllStructGetData( DllStructCreate( "wchar[128]", DllStructGetData($tCodec, "FormatDesc")), 1 ) $aInfo[$iI][6] = DllStructGetData( DllStructCreate( "wchar[128]", DllStructGetData($tCodec, "FileExt")), 1 ) $aInfo[$iI][7] = DllStructGetData( DllStructCreate( "wchar[128]", DllStructGetData($tCodec, "MimeType")), 1 ) $aInfo[$iI][8] = DllStructGetData($tCodec, "Flags") $aInfo[$iI][9] = DllStructGetData($tCodec, "Version") $aInfo[$iI][10] = DllStructGetData($tCodec, "SigCount") $aInfo[$iI][11] = DllStructGetData($tCodec, "SigSize") $aInfo[$iI][12] = DllStructGetData($tCodec, "SigPattern") $aInfo[$iI][13] = DllStructGetData($tCodec, "SigMask") $pBuffer += DllStructGetSize($tCodec) Next Return $aInfo EndFunc ;==>_GDIPlus_Encoders 3. Replace _GDIPlus_GetDecoders: Func _GDIPlus_Decoders() Local $iCount = _GDIPlus_DecodersGetCount() Local $iSize = _GDIPlus_DecodersGetSize() Local $tBuffer = DllStructCreate("byte[" & $iSize & "]") Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetImageDecoders", "uint", $iCount, "uint", $iSize, "struct*", $tBuffer) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] Then Return SetError(10, $aResult[0], 0) Local $pBuffer = DllStructGetPtr($tBuffer) Local $tCodec, $aInfo[$iCount + 1][14] $aInfo[0][0] = $iCount For $iI = 1 To $iCount $tCodec = DllStructCreate($tagGDIPIMAGECODECINFO, $pBuffer) $aInfo[$iI][1] = _WinAPI_StringFromGUID(DllStructGetPtr($tCodec, "CLSID")) $aInfo[$iI][2] = _WinAPI_StringFromGUID(DllStructGetPtr($tCodec, "FormatID")) $aInfo[$iI][3] = DllStructGetData( DllStructCreate( "wchar[128]", DllStructGetData($tCodec, "CodecName")), 1 ) $aInfo[$iI][4] = DllStructGetData( DllStructCreate( "wchar[128]", DllStructGetData($tCodec, "DllName")), 1 ) $aInfo[$iI][5] = DllStructGetData( DllStructCreate( "wchar[128]", DllStructGetData($tCodec, "FormatDesc")), 1 ) $aInfo[$iI][6] = DllStructGetData( DllStructCreate( "wchar[128]", DllStructGetData($tCodec, "FileExt")), 1 ) $aInfo[$iI][7] = DllStructGetData( DllStructCreate( "wchar[128]", DllStructGetData($tCodec, "MimeType")), 1 ) $aInfo[$iI][8] = DllStructGetData($tCodec, "Flags") $aInfo[$iI][9] = DllStructGetData($tCodec, "Version") $aInfo[$iI][10] = DllStructGetData($tCodec, "SigCount") $aInfo[$iI][11] = DllStructGetData($tCodec, "SigSize") $aInfo[$iI][12] = DllStructGetData($tCodec, "SigPattern") $aInfo[$iI][13] = DllStructGetData($tCodec, "SigMask") $pBuffer += DllStructGetSize($tCodec) Next Return $aInfo EndFunc ;==>_GDIPlus_Decoders Full file attached. GDIPlus.zip
Moderators Melba23 Posted February 8, 2018 Moderators Posted February 8, 2018 Imp, The place to bring that up is as a "Feature Request" in Trac - open a ticket if you feel it is worth doing and the Devs will consider it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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