Create EXE?

Just starting out? Need help? Post your questions and find answers here.
sharkbate24
User
User
Posts: 50
Joined: Sat Aug 30, 2008 3:21 pm

Create EXE?

Post by sharkbate24 »

Hello everyone,

I want to have a go at making an Update Patcher, where the user can create patches for his program / game. I want to know how I can go abouts creating an EXE file from a program I create, after the user presses a button?

Thanks everyone.
[Registed PB User]
[Windows XP SP2 | PureBasic 4.20]
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Code: Select all

OpenWindow(0, #PB_Ignore, #PB_Ignore, 100, 50, "PatchCreater", #PB_Window_SystemMenu)
CreateGadgetlist(WindowID(0))
ButtonGadget(0, 10, 10, 80, 30, "create")

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow : Break
    Case #PB_Event_Gadget
      If EventGadget() = 0
        If CreateFile(0, "Patcher.exe")
          For i = 0 To 1000
            WriteLong(0, Random(999999))
          Next
          CloseFile(0)
          MessageRequester("PatchCreater", "Patch successfull created")
          End
        EndIf
      EndIf
  EndSelect
ForEver
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

@ts

I thought tomorrow was All Hallows Eve, not April Foolz...
oh... and have a nice day.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

sharkbate24:
I think this may solve the problem:
http://kobik.net/codefusion.asp
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

Kaeru Gaman wrote:@ts

I thought tomorrow was All Hallows Eve, not April Foolz...
Not true... if he runs that code enough times... one time he will have FALLOUT 3 the complete version...

It may take a while what with the randomness and all... :D
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Sorry Rook, your wrong...

Fallout3 will be larger than 4KB ;)

(plus a larger random number [-1?] would be needed)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

Well, he probably want to include a exe and then extract it...
Like this:

Code: Select all

DataSection
  ExeFile: IncludeBinary "whatever.exe"
  DataEnd:
EndDataSection 

If CreateFile(0,"whatever.exe")
  WriteData(0,?ExeFile,?DataEnd-?ExeFile)
  CloseFile(0)
EndIf
I like logic, hence I dislike humans but love computers.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

After re-reading the first post I think your right - I though he wanted a system that could create the patch files (in which case http://kobik.net/codefusion.asp would do the job).
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Based on the announcement, that seems to be correct.
sharkbate24
User
User
Posts: 50
Joined: Sat Aug 30, 2008 3:21 pm

Post by sharkbate24 »

rsts wrote:Based on the announcement, that seems to be correct.
Yeah, basically I did it another way, rather than create an EXE. I'd like to know how to create an exe with the users input though, but I guess it would be hard?

Thanks.
[Registed PB User]
[Windows XP SP2 | PureBasic 4.20]
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

OK 1 clue... LINKERs.

One way to make a program run in the old days was to use a LINKER at the end... OK my swiss cheese brain may be miscalling it but most BASIC compilers back in the day only had a small startup piece and then the basic code and then the tiny linker/COM runner at the end to run it!

If I am remembering correctly!

:D
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Post Reply