Page 1 of 1
How to embed an Image in the executable?
Posted: Mon Jun 17, 2019 9:40 pm
by RobertRioja
I have questions but I cannot find answers in the PB documentation.
How do I embed an image into the executable file? In other words, how do I put an image into a resource file in PB? And how do I get that image into an image button?
Thanks,
Robert
Re: How to embed an Image in the executable?
Posted: Mon Jun 17, 2019 9:50 pm
by RSBasic
Example:
Code: Select all
EnableExplicit
CatchImage(1, ?Logo)
If OpenWindow(0, 0, 0, 500, 400, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonImageGadget(1, 10, 10, 50, 50, ImageID(1), 0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf
DataSection
Logo:
IncludeBinary "D:\...\YourIcon.ico" ;-change the path
EndDataSection
Re: How to embed an Image in the executable?
Posted: Mon Jun 17, 2019 9:52 pm
by skywalk
Use:
DataSection
Image1: IncludeBinary File
EndDataSection
and
img_n = CatchImage(#PB_Any, ?Image_1) ; , img1_Size)
DOH! too late.
Re: How to embed an Image in the executable?
Posted: Tue Jun 18, 2019 6:08 pm
by RobertRioja
Thank you all for your replies.
Robert