Skip to main content
gamedev.net
🔒 Locked

execute another application problem.Pls help.Thanks

Started by Apache Apr 10, 2002 at 7:52 PM 0 replies 150+ views
Original Post
Apache
Apache
Hi, I have a dialog type application, A in VC++ which need to execute and pass some information to a single document with database view type application, B.I can easily execute the B without passing any information easily but when i need to pass some information to B, it seems that there is some problem.Because I actually need to pass the information to B and the B in turns input the information to the database.Lets say for the B to execute, which part of the code does it call?To call another application to execute,this is how it works. In application A, sprintf(strMsg, "testing | %s ", strRemoteBDAddr); _spawnlp(_P_NOWAIT,"ISDatabaseAccess","HMMM",strMsg,NULL); ISDatabaseAccess is the name of the application B. strMsg is the char[100] information that is going to be passed. _spawnlp is the command to execute another application. In application B, BOOL CISDatabaseAccessView:reCreateWindow(CREATESTRUCT& cs) { CWinApp *pApp; pApp = AfxGetApp( ); CHAR *str_BDAddr = NULL; str_BDAddr = pApp->m_lpCmdLine; //get the information from application A m_bdaddress_edit.ReplaceSel((CString)str_BDAddr); return CRecordView:reCreateWindow(cs); } I place the code where it retrieve the data in the PreCreateWindow(..) because I think this is the first function it will called when it first started but it will still pop up an error saying the data is not found.I tried to put the retrieving of data codes in OnInitialUpdate() functions but it also popup the same error.I may not explain this problem clearly but this is all I know how to explain my problem.Can someone kindly help me?Thank you.
Kwizatz
Kwizatz
Its not very clear to me but if you want A to run B and then pass information from A to B then:

Use ShellExecute on A, something like

ShellExecute(NULL, "open","B.EXE", NULL, NULL, SW_SHOWNORMAL);

then use the WM_COPYDATA windows message to move data from one application to the other in either way, IF you did not write B, you will have to be more tricky, you will have to research on FindWindow and SetWindowsHookEx, trapping messages and sending messages to B this way, creating some sort of parasite program, I once did one for a casino program, got the thing to play blackjack for me . . . didnt made any money though . . . said too much

good luck.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.