Open ysquare opened 1 year ago
example
Gdip_Startup()
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
pToken := 0
if !DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
DllCall("LoadLibrary", "str", "gdiplus")
VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
DllCall("gdiplus\GdiplusStartup", A_PtrSize ? "UPtr*" : "uint*", pToken, Ptr, &si, Ptr, 0)
return pToken
}
replace
Gdip_Startup()
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
pToken := 0
if !DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
DllCall("LoadLibrary", "str", "gdiplus")
;VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
si := Buffer(A_PtrSize = 8 ? 24 : 16, 0)
NumPut("int", 1, si.Ptr)
DllCall("gdiplus\GdiplusStartup", A_PtrSize ? "UPtr*" : "uint*", &pToken, Ptr, si.Ptr, Ptr, 0)
return pToken
}
The problem is that this library was meant to be backwards compatible to work on both v1 and v2...
VarSetCapacity is no longer available in ahk v2.0 release, replaced by Buffer() according to the document.