Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting program variables from another program

Status
Not open for further replies.

PrograMan

Programmer
Jul 21, 2001
59
US
Whoa, something to challenge the brain. How do you obtain variables from one Visual C++ program and apply it to the main one you're working with? (i.e. you have a main program going which opens another program and the main program needs that program's variables.
 
in general you manage this by using
named pipes. One of your program can
write into the pipe, while the other
one reads out of the pipe.

You can use named pipes for large data-
streamexchange as well and last but not
least to synchronize the streamexchange.

;)
netcomander
 
How would I go about doing that? Is there a good URL for doing such a thing in C++?
 
Create a dll what and link it to both programs. Create in it a variable or a function what get variable from one program.

for example id dll:
int x;
__declspec(dllexport) void set_x(int xx){x=xx;}
__declspec(dllexport) int get_x(){return x;}
in exe:
__declspec(dllimport) void set_x(int);
__declspec(dllimport) int get_x(); John Fill
1c.bmp


ivfmd@mail.md
 
I recently did some work with named pipes and got it to work in no time. Search on named pipes in the help files and you will find a sample application. A data type is no longer used so you need to update it but... if you want my source code send me an email.

Matt

Zyrenthian@home.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top