Click here to Skip to main content
15,909,827 members
Home / Discussions / C#
   

C#

 
GeneralSaving to exe Pin
SimpleData4-Feb-09 7:17
SimpleData4-Feb-09 7:17 
GeneralRe: Saving to exe Pin
musefan4-Feb-09 7:31
musefan4-Feb-09 7:31 
GeneralRe: Saving to exe Pin
musefan4-Feb-09 7:44
musefan4-Feb-09 7:44 
GeneralRe: Saving to exe Pin
Alan N4-Feb-09 7:51
Alan N4-Feb-09 7:51 
GeneralRe: Saving to exe Pin
musefan4-Feb-09 22:32
musefan4-Feb-09 22:32 
GeneralRe: Saving to exe Pin
Dave Kreskowiak4-Feb-09 10:32
mveDave Kreskowiak4-Feb-09 10:32 
GeneralRe: Saving to exe Pin
SimpleData4-Feb-09 10:40
SimpleData4-Feb-09 10:40 
GeneralRe: Saving to exe Pin
Dave Kreskowiak4-Feb-09 12:27
mveDave Kreskowiak4-Feb-09 12:27 
SimpleData wrote:
So, instead of my writing into EXE idea. What can I do to change a variable within the application and keep that variable same after I restarted it?


There is no alternative, other than saving in the Registry or files external to the .EXE.


SimpleData wrote:
As an extra idea, how can I make an application which creates another exe from itself with modifying a variable or value of itself?


The same way you read/write any binary file. Read the .EXE file until you get to the point where the string is, write all that data to a new file, then write the string data, skip reading the string in the source .EXE file, and continue to read the old file to the end, writing it's data to the new file.

But, you have a problem. You STILL need an external application to delete the old .EXE and rename the new .EXE to the old filename. Not, a good solution...


A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008




GeneralRe: Saving to exe Pin
come2san5-Feb-09 1:33
come2san5-Feb-09 1:33 
GeneralRe: Saving to exe Pin
Dave Kreskowiak5-Feb-09 2:08
mveDave Kreskowiak5-Feb-09 2:08 
GeneralRe: Saving to exe Pin
PIEBALDconsult9-Feb-09 12:14
mvePIEBALDconsult9-Feb-09 12:14 
QuestionWPF in WinForms Pin
musefan4-Feb-09 7:07
musefan4-Feb-09 7:07 
AnswerRe: WPF in WinForms Pin
Christian Graus4-Feb-09 9:25
protectorChristian Graus4-Feb-09 9:25 
GeneralRe: WPF in WinForms Pin
musefan4-Feb-09 22:30
musefan4-Feb-09 22:30 
QuestionParsing text files Pin
alwaysthinking4-Feb-09 6:59
alwaysthinking4-Feb-09 6:59 
AnswerRe: Parsing text files Pin
musefan4-Feb-09 7:10
musefan4-Feb-09 7:10 
AnswerRe: Parsing text files Pin
PIEBALDconsult4-Feb-09 7:11
mvePIEBALDconsult4-Feb-09 7:11 
GeneralRe: Parsing text files Pin
alwaysthinking4-Feb-09 7:25
alwaysthinking4-Feb-09 7:25 
GeneralRe: Parsing text files Pin
alwaysthinking4-Feb-09 7:36
alwaysthinking4-Feb-09 7:36 
GeneralRe: Parsing text files Pin
Alan N4-Feb-09 7:46
Alan N4-Feb-09 7:46 
GeneralRe: Parsing text files Pin
PIEBALDconsult4-Feb-09 8:07
mvePIEBALDconsult4-Feb-09 8:07 
GeneralRe: Parsing text files Pin
PIEBALDconsult4-Feb-09 10:18
mvePIEBALDconsult4-Feb-09 10:18 
GeneralRe: Parsing text files Pin
alwaysthinking9-Feb-09 8:35
alwaysthinking9-Feb-09 8:35 
GeneralRe: Parsing text files Pin
alwaysthinking9-Feb-09 8:36
alwaysthinking9-Feb-09 8:36 
GeneralRe: Parsing text files Pin
PIEBALDconsult9-Feb-09 11:59
mvePIEBALDconsult9-Feb-09 11:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.