GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 15-Apr-2008, 00:41
Jana Jana is offline
New Member
 
Join Date: Apr 2008
Posts: 10
Jana is on a distinguished road

Run an "exe" and wait till its closed


Hi Guys,,,

I'm working with an existing MFC application. I need to run a VB .NET application via this MFC application and wait till its closes....

I went thru several websites which suggested that I use ProcessStartInfo and run the VB.NET and wait for that...

when I insert
#using <system.dll> I'm getting CLR error
"fatal error C1190: managed targeted code requires a '/clr' option"

I'm not familiar with whats going on or how they developed the MFC application .All I know is that I ended up with lot of classes and I need to do minor changes...

Is anyone outthere who could help me out with this? Is there any other way of running the VB .NET application via this MFC application?

Thanks in advance,,
Jana
  #2  
Old 21-Apr-2008, 01:48
Jana Jana is offline
New Member
 
Join Date: Apr 2008
Posts: 10
Jana is on a distinguished road
Post

Re: Run an "exe" and wait till its closed


Oh..I was so stupid...it was so easy....

http://forums.devx.com/showthread.php?threadid=159692

Here is the code which does the trick which was copied from the above link....

#############################

STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );

TCHAR szCommandLine[] = _T("\"C:\\Windows\\system32\\calc.exe\"");
if( !CreateProcess( NULL, szCommandLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ) )
{
_tprintf( _T("CreateProcess failed - %d\n"), GetLastError() );
return;
}

WaitForSingleObject( pi.hProcess, INFINITE );
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );

#########################

cheers guys

Jana
 
 

Recent GIDBlogFlickr uploads of IA pictures by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
wait() and waitpid() functions groberts1980 C Programming Language 3 20-Sep-2006 17:57
Java threads trouble (wait() and notify()) smoothdogg00 Java Forum 3 08-Apr-2006 15:45

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 05:01.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.