Compiling question

Windows specific forum
Large
User
User
Posts: 56
Joined: Tue Apr 29, 2003 8:24 pm

Compiling question

Post by Large »

I want to include some .bmp's inside my exe.

Could someone tell me how to compile other files inside the executable ?

Kind regards

Andy ( aka Large )
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Hi,

You can include anything you like into an exe, just use:

filestart1:
IncludeBinary"Installer.exe"
fileend1:

filestart2:
IncludeBinary"Installer.doc"
fileend2:

filestart3:
IncludeBinary"Installer.dll"
fileend3:

then to extract the files:

If CreateFile(0, filenamex)
WriteData(?filestartx, ?fileendx- ?filestartx) ; (x = filenumber)
CloseFile(0)
EndIf
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Re: Compiling question

Post by TerryHough »

Large wrote:I want to include some .bmp's inside my exe.
This works for me

Code: Select all

CatchImage(0, ?Logo)
UseImage(0)

If OpenWindow(1, 0, 0, 200, 100,#PB_Window_ScreenCentered| #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "Embedded Image")
  CreateGadgetList(WindowID())
  x = (WindowWidth() - ImageWidth()) / 2
  y = (WindowHeight() - ImageHeight()) /2
  ImageGadget(0, x, y, ImageWidth(), ImageHeight(), 0, #PB_Image_Border)
EndIf 

  SetGadgetState(0, ImageID())  ; Change the picture in the gadget
   ; ---------------- This is the main processing loop ----------------------
  Repeat
    EventID = WaitWindowEvent()
     
    ; ------------------- Process the menu events --------------------------
    If EventID = #PB_EventMenu
      Select EventMenuID()     ;  see which menu item was selected
        Case 1    ; Import
        Case 5    ; Exit menu chosen
          Quit = 1  ; Set the exit flag
      EndSelect
    EndIf
     
    ; ------------------ Process the gadget events -------------------------
    If EventID = #PB_EventGadget
      Select EventGadgetID()
        Case 1    ; Panel gadget chosen
      EndSelect
    EndIf   
      
    If EventID =  #WM_CLOSE ;  #PB_EventCloseWindow
      Quit = 1      
    EndIf

  ; ------------ Insure changes are saved when quit received ---------------
  If Quit = 1
;   Miscellaneous cleanups before closing
  EndIf  

  Until Quit = 1
  ; -------------------End of the main processing loop ---------------------
End

Logo: IncludeBinary "purebasic.bmp"
Hope this helps,
Terry
Post Reply