Image Width/Height?

BlitzMax Forums/MaxGUI Module/Image Width/Height?

CopperCircle(Posted 2007) [#1]
Hi, I am new to BlitzMax and I am using this code from the forums to create image buttons.
Does anyone know how I can get the image size of the loaded button image?

Function CreateImageButton:TGadget(imagefile:String, x, y, width, height, group:TGadget)
Extern "win32"
Function LoadImageA:Int (hInst%, lpsz$z, un1%, n1%, n2%, un2%)
Function SetWindowLongA:Int ( hWnd%, Val%, Lng% )
Function GetWindowLongA% ( hWnd%, Val% )
Function SendMessageA% ( hWnd%, Msg%, wParam%, lParam% )
End Extern

Const LR_LOADFROMFILE = 16
Const GWL_STYLE = -16
Const BS_BITMAP = 128
Const BM_SETIMAGE = 247
Const IMAGE_BITMAP = 0
Const IMAGE_ICON = 1

Local i = LoadImageA( 0, imagefile$, IMAGE_BITMAP, 0,0, LR_LOADFROMFILE )
If Not i Then Notify imagefile + " not found.", True ; End
Local button:TGadget = CreateButton("", x, y, width, height, group)
Local hbutton = QueryGadget( button, QUERY_HWND_CLIENT )
Local flags = GetWindowLongA( hbutton, GWL_STYLE ) + BS_BITMAP
SetWindowLongA hbutton, GWL_STYLE,flags
SendMessageA hbutton, BM_SETIMAGE, IMAGE_BITMAP, i

Return button
End Function


JoshK(Posted 2007) [#2]
http://blitzmax.com/Community/posts.php?topic=65188#727597


CopperCircle(Posted 2007) [#3]
Thanks, but I am still trying to find a way to get the size of the image loaded via win32(LoadImageA), then I can automatically size the button to the image.