Anbu Posted July 6, 2009 Share Posted July 6, 2009 Hi, I am getting the following error message after running Autoit script. WinAPI CreateCompatibleBitmap: The specified module could not be found. In my script I am using Autoit function "_ScreenCapture_Capture". After saving approximately 900 images, we are getting the error message "WinAPI CreateCompatibleBitmap: The specified module could not be found." and Autoit script starts running. Because of this problem our script is running for around 5 hours and stops. But our intention is to execute the script, without stopping in the middle. please provide solution to this problem, so that our script efficiency will increase. Link to comment Share on other sites More sharing options...
Yashied Posted July 6, 2009 Share Posted July 6, 2009 Hi,I am getting the following error message after running Autoit script.WinAPI CreateCompatibleBitmap: The specified module could not be found.In my script I am using Autoit function "_ScreenCapture_Capture".After saving approximately 900 images, we are getting the error message "WinAPI CreateCompatibleBitmap: The specified module could not be found." and Autoit script starts running.Because of this problem our script is running for around 5 hours and stops. But our intention is to execute the script, without stopping in the middle.please provide solution to this problem, so that our script efficiency will increase.You do not accidentally forget about _WinAPI_DeleteObject()? My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Anbu Posted July 6, 2009 Author Share Posted July 6, 2009 You do not accidentally forget about _WinAPI_DeleteObject()?Hi,It is taken care in the following library function available under "Include" folder in istallation directory._ScreenCapture_Capture. This function is available in ScreenCapture.au3. Link to comment Share on other sites More sharing options...
trancexx Posted July 6, 2009 Share Posted July 6, 2009 It's a bug. You can submit it (do that really).Your script will brake because of leaking GDI objects. Replace current _ScreenCapture_Capture() with this one and you will be ok:Func _ScreenCapture_Capture($sFileName = "", $iLeft = 0, $iTop = 0, $iRight = -1, $iBottom = -1, $fCursor = True) Local $iH, $iW, $hWnd, $hDDC, $hCDC, $hBMP, $aCursor, $aIcon, $hIcon If $iRight = -1 Then $iRight = _WinAPI_GetSystemMetrics($__SCREENCAPTURECONSTANT_SM_CXSCREEN) If $iBottom = -1 Then $iBottom = _WinAPI_GetSystemMetrics($__SCREENCAPTURECONSTANT_SM_CYSCREEN) If $iRight < $iLeft Then Return SetError(-1, 0, 0) If $iBottom < $iTop Then Return SetError(-2, 0, 0) $iW = $iRight - $iLeft $iH = $iBottom - $iTop $hWnd = _WinAPI_GetDesktopWindow() $hDDC = _WinAPI_GetDC($hWnd) $hCDC = _WinAPI_CreateCompatibleDC($hDDC) $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iW, $iH) _WinAPI_SelectObject($hCDC, $hBMP) _WinAPI_BitBlt($hCDC, 0, 0, $iW, $iH, $hDDC, $iLeft, $iTop, $__SCREENCAPTURECONSTANT_SRCCOPY) If $fCursor Then $aCursor = _WinAPI_GetCursorInfo() If $aCursor[1] Then $hIcon = _WinAPI_CopyIcon($aCursor[2]) $aIcon = _WinAPI_GetIconInfo($hIcon) _WinAPI_DrawIcon($hCDC, $aCursor[3] - $aIcon[2] - $iLeft, $aCursor[4] - $aIcon[3] - $iTop, $hIcon) _WinAPI_DestroyIcon($hIcon) _WinAPI_DeleteObject($aIcon[4]); <- THIS! _WinAPI_DeleteObject($aIcon[5]); <- THIS! EndIf EndIf _WinAPI_ReleaseDC($hWnd, $hDDC) _WinAPI_DeleteDC($hCDC) If $sFileName = "" Then Return $hBMP _ScreenCapture_SaveImage($sFileName, $hBMP) _WinAPI_DeleteObject($hBMP) EndFunc ;==>_ScreenCapture_CaptureThe problem is related to the cursor (I've made a comment pointing to it in the fixed function). Reference is this (remarks section). ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Anbu Posted July 6, 2009 Author Share Posted July 6, 2009 It's a bug. You can submit it (do that really). Your script will brake because of leaking GDI objects. Replace current _ScreenCapture_Capture() with this one and you will be ok:Func _ScreenCapture_Capture($sFileName = "", $iLeft = 0, $iTop = 0, $iRight = -1, $iBottom = -1, $fCursor = True) Local $iH, $iW, $hWnd, $hDDC, $hCDC, $hBMP, $aCursor, $aIcon, $hIcon If $iRight = -1 Then $iRight = _WinAPI_GetSystemMetrics($__SCREENCAPTURECONSTANT_SM_CXSCREEN) If $iBottom = -1 Then $iBottom = _WinAPI_GetSystemMetrics($__SCREENCAPTURECONSTANT_SM_CYSCREEN) If $iRight < $iLeft Then Return SetError(-1, 0, 0) If $iBottom < $iTop Then Return SetError(-2, 0, 0) $iW = $iRight - $iLeft $iH = $iBottom - $iTop $hWnd = _WinAPI_GetDesktopWindow() $hDDC = _WinAPI_GetDC($hWnd) $hCDC = _WinAPI_CreateCompatibleDC($hDDC) $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iW, $iH) _WinAPI_SelectObject($hCDC, $hBMP) _WinAPI_BitBlt($hCDC, 0, 0, $iW, $iH, $hDDC, $iLeft, $iTop, $__SCREENCAPTURECONSTANT_SRCCOPY) If $fCursor Then $aCursor = _WinAPI_GetCursorInfo() If $aCursor[1] Then $hIcon = _WinAPI_CopyIcon($aCursor[2]) $aIcon = _WinAPI_GetIconInfo($hIcon) _WinAPI_DrawIcon($hCDC, $aCursor[3] - $aIcon[2] - $iLeft, $aCursor[4] - $aIcon[3] - $iTop, $hIcon) _WinAPI_DestroyIcon($hIcon) _WinAPI_DeleteObject($aIcon[4]); <- THIS! _WinAPI_DeleteObject($aIcon[5]); <- THIS! EndIf EndIf _WinAPI_ReleaseDC($hWnd, $hDDC) _WinAPI_DeleteDC($hCDC) If $sFileName = "" Then Return $hBMP _ScreenCapture_SaveImage($sFileName, $hBMP) _WinAPI_DeleteObject($hBMP) EndFunc ;==>_ScreenCapture_Capture The problem is related to the cursor (I've made a comment pointing to it in the fixed function). Reference is this (remarks section). Hi, Thank you, very much. How to log a defect? We will test and get back. Link to comment Share on other sites More sharing options...
trancexx Posted July 6, 2009 Share Posted July 6, 2009 Resistance is futile.Use Bug Reports and Feature Requests section. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Malkey Posted July 6, 2009 Share Posted July 6, 2009 It's a bug. You can submit it (do that really).Your script will brake because of leaking GDI objects. Replace current _ScreenCapture_Capture() with this one and you will be ok:The problem is related to the cursor (I've made a comment pointing to it in the fixed function). Reference is this (remarks section).trancexxWell found.Another "reference to this" is the AutoIt help file under _WinAPI_GetIconInfo. Link to comment Share on other sites More sharing options...
rover Posted July 6, 2009 Share Posted July 6, 2009 I submitted this bug to Trac 2 weeks ago, and it's fixed in version: 3.3.1.2_ScreenCapture_Capture(): GDI object leak with cursor captureTicket:#1040 I see fascists... Link to comment Share on other sites More sharing options...
Anbu Posted July 6, 2009 Author Share Posted July 6, 2009 I submitted this bug to Trac 2 weeks ago, and it's fixed in version: 3.3.1.2_ScreenCapture_Capture(): GDI object leak with cursor captureTicket:#1040Hi,Sorry. Without the awareness of your bug, I have added a new bug.Thank you. Link to comment Share on other sites More sharing options...
boomingranny Posted February 1, 2010 Share Posted February 1, 2010 (edited) this bug still exists in the latest version of AutoIT (3.3.4.0), was it re-added somehow?! Edited February 1, 2010 by boomingranny 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