Code: Select all
If IsImage(*dat\image)
FreeImage(*dat\image)
EndIf
Code: Select all
If IsImage(*dat\image)
FreeImage(*dat\image)
EndIf
Code: Select all
Structure udtData
Image.i
EndStructure
Global *MyData.udtData = AllocateStructure(udtData)
*MyData\Image = LoadImage(#PB_Any, #PB_Compiler_Home + "examples/sources/Data/PureBasic.bmp")
If *MyData\Image = 0
Debug "Error load image"
End
EndIf
If OpenWindow(0, 0, 0, 240, 100, "ButtonImage", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonImageGadget(0, 10, 10, 220, 60, ImageID(*MyData\Image))
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
FreeImage(*MyData\Image)
FreeStructure(*MyData)
Delay(100)