Code: Select all
Gdip_Startup()
{
pToken := 0
VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), NumPut("UInt", 1, &si)
if DllCall("gdiplus\GdiplusStartup", "PtrP", pToken, "Ptr", &si, "UPtr", 0) ; ok
PromptMsg("Error in loading GDIP")
return pToken
}
Code: Select all
Gdip_Startup()
{
pToken := 0
si := BufferAlloc(A_PtrSize = 8 ? 24 : 16), NumPut("UInt", 1, si)
if DllCall("gdiplus\GdiplusStartup", "PtrP", pToken, "Ptr", si, "UPtr", 0) ; failed
PromptMsg("Error in loading GDIP")
return pToken
}
Following is part of code from ImageButton class of justme
Code: Select all
; Create a BUTTON_IMAGELIST structure
VarSetCapacity(BIL, 20 + A_PtrSize, 0) ; work
;~ BIL := BufferAlloc(20 + A_PtrSize) ; not work
NumPut("Ptr", HIL, BIL)
Numput("UInt", BUTTON_IMAGELIST_ALIGN_CENTER, BIL, A_PtrSize + 16)
; Hide buttons's caption
Btn.Text := ""
Btn.Opt("+" BS_BITMAP)
; Assign the ImageList to the button
SendMessage(BCM_SETIMAGELIST, 0, 0,HWND)
SendMessage(BCM_SETIMAGELIST, 0, &BIL,HWND) ; work
;~ SendMessage(BCM_SETIMAGELIST, 0, BIL,HWND) ; code for BufferAlloc, failed