When initializing GDIPlus with the function: _GDIPlus_Startup()
I get an error on Win2000 (no GDI installed):
AVector: []: Out of bounds.
Bug occured on: Win2000 SP4 DE, compiled AutoIT-Script 3.2.10.0
(Compiled on: WinXP SP2 DE; AutoIT 3.2.10.0)
I tried to track down the problem and noticed, that $ghGDIPDll is -1 (means, no handle to the GDIPlus.dll available).
The _WinAPI_Check() after DLLOpen doesn't seem to make the job.
Maybe a additional condition 'If $ghGDIPDll = -1 Then return False' would prevent the crash.
Maybe there is also a 'bug' in the DllCall function, I think it shouldn't 'crash' if a invalid handle is passed.
Kind regards,
Christian
PS: AutoIt is great, I love it.
Plain Text
; #FUNCTION# ==================================================================================================== ================ ; Name...........: _GDIPlus_Startup ; Description ...: Initialize Microsoft Windows GDI+ ; Syntax.........: _GDIPlus_Startup() ; Parameters ....: ; Return values .: Success - True ; Failure - False ; Author ........: Paul Campbell (PaulIA) ; Modified.......: ; Remarks .......: Call _GDIPlus_Startup before you create any GDI+ objects. GDI+ requires a redistributable for applications that ; run on the Microsoft Windows NT 4.0 SP6, Windows 2000, Windows 98, and Windows Me operating systems. ; Related .......: _GDIPlus_Shutdown ; Link ..........; @@MsdnLink@@ GdiplusStartup ; Example .......; Yes ; ==================================================================================================== =========================== Func _GDIPlus_Startup() Local $pInput, $tInput, $pToken, $tToken, $aResult $giGDIPRef += 1 If $giGDIPRef > 1 Then Return True $ghGDIPDll = DllOpen("GDIPlus.dll") _WinAPI_Check("_GDIPlus_Startup (GDIPlus.dll not found)", @error, -1) ;ADD: If $ghGDIPDll = -1 Then Return False $tInput = DllStructCreate($tagGDIPSTARTUPINPUT) $pInput = DllStructGetPtr($tInput) $tToken = DllStructCreate("int Data") $pToken = DllStructGetPtr($tToken) DllStructSetData($tInput, "Version", 1) $aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "ptr", $pToken, "ptr", $pInput, "ptr", 0) $giGDIPToken = DllStructGetData($tToken, "Data") Return $aResult[0] <> 0 EndFunc ;==>_GDIPlus_Startup




