|
-
Apr 18th, 2010, 10:44 AM
#1
Thread Starter
Member
Question : passing value to variable in another program
hello all sorry if title isn't clear enough
let me explain quit tall words :
i'm making program that deal with MS SQL Server 2000 and called it "ProgramA.exe"
so at run time if the connection with Server is lost for any reason(Interned Down - Server Down -....etc) and there are function or sub that will deal with Server it will return error ,i already try to handle most Place that errors may occur,but how know
so i design another application that make check for server every specific time (5 minutes) and called it "SrvChk.exe"
and in program "Program A.exe" there are variable called "Srv_statue" that will hold value of connection "Connected" or "Error returned"
so now question is :
how to make the second application "SrvChk.exe" after check connection to server Pass the value to variable in Program 1 "Program A" that Called "Srv_statue" ??
-
Apr 18th, 2010, 11:13 AM
#2
Re: Question : passing value to variable in another program
There are various solutions. Search the forum for IPC (interprocess communication). Here are a few possibilities.
1. Use DDE to talk between the two apps
2. Use a shared text file, physical or mapped
3. Use SetWindowText API to send a string to a hidden textbox
4. Use subclassing and pass/trap WM_COPYDATA or a custom message
5. Pass your srvCheck.exe, in a command line, information it can us to talk to your main app; srvCheck parses Command$ variable.
6. About a 1/2 dozen other possibilities that may be combinations of the above or similar
-
Apr 18th, 2010, 12:43 PM
#3
Re: Question : passing value to variable in another program
You can use Named Pipes. There are a lot of examples already on the forums and on planet-source-code.com
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|