This is my code:
Code: Select all
Gdip_MeasureString(pGraphics, sString, hFont, hFormat, ByRef RectF)
{
Ptr := A_PtrSize ? "UPtr" : "UInt"
RC := BufferAlloc(16)
Chars := 0
Lines := 0
DllCall("gdiplus\GdipMeasureString"
, Ptr, pGraphics
, Ptr, StrPtr(sString)
, "Int", -1
, Ptr, hFont
, Ptr, ObjPtr(RectF)
, Ptr, hFormat
, Ptr, ObjPtr(RC)
, "UInt*", Chars
, "UInt*", Lines)
return ObjPtr(RC) ? NumGet(RC, 0, "Float") "|" NumGet(RC, 4, "Float") "|" NumGet(RC, 8, "Float") "|" NumGet(RC, 12, "Float") "|" Chars "|" Lines : 0
}
Code: Select all
Ptr . "*"
I know that pGraphics is valid as it is used to draw other shapes onto. sString is a valid string. hFont is a valid font object. RectF is a bounding box that is at 0, 0 and is 200x80. hFormat is constructed via bitwise operations as 1|1 because I specified both vertical and horizontal centering.
the Gdip_DrawString function takes all of the same parameters and it actually works, so I'm having trouble figuring out what I'm doing wrong that's preventing me from getting an updated RC structure from the DllCall.
Could anyone provide any tips on this? Thanks!