Page 1 of 1

Compiling question

Posted: Wed Jun 18, 2003 6:39 pm
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 )

Posted: Wed Jun 18, 2003 7:19 pm
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

Re: Compiling question

Posted: Wed Jun 18, 2003 9:23 pm
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