Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Coffee corner » Is it possible ? (Question about casting ptr to string then cast it back in another process)
Re: Is it possible ? [message #51759 is a reply to message #51757] Thu, 16 May 2019 21:19 Go to previous messageGo to previous message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
Under modern OS the processes have virtual address space, separated by from each other, i.e. when the new exe is running, the memory address from old exe is invalid and not accessible.

You can do some IPC (inter process communication) to do it like this, but I'm not sure why.

If you are only interested in version value, I would probably rather include that in some resource file, and use resource reading to read values from your current exe, and from the other exe and compare those, then you don't need to run the other exe at all to figure out if you need update.

Is there some other requirement forcing you to actually put the value into code?

If yes, you can still do this in simple way, supporting in `main` function extra command line option like `--getversion`, which will return version value as exit code (if values 1..255 are enough for you), or you can output it to STDOUT and execute the other exe in such way, that you will collect all STDOUT in first exe, but this is getting somewhat over-complicated.

As you are writing something about text file, it sounds to me like you can add the version value straight into resources (actually if we are talking about Windows .exe files, those already have some kind of meta data - check properties on exe files, there's often various info who's author, version numbers, etc.. = that's all meta data specified in some resource/manifest file, and you can read those somehow also in code, just by reading the .exe file as data, no need to execute it.
 
Read Message
Read Message
Read Message
Previous Topic: Good way to manage data without a database ?
Next Topic: Adding Version Information & Icons to app's exe file
Goto Forum:
  


Current Time: Mon Apr 29 01:39:38 CEST 2024

Total time taken to generate the page: 0.04148 seconds