Click here to Skip to main content
15,926,939 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Hidden my Application in tag list Pin
David Crow29-Sep-04 2:53
David Crow29-Sep-04 2:53 
GeneralRe: Hidden my Application in tag list Pin
Gledston Reis29-Sep-04 8:47
sussGledston Reis29-Sep-04 8:47 
GeneralCD rom Context menu Pin
anandforu28-Sep-04 2:50
anandforu28-Sep-04 2:50 
GeneralRe: CD rom Context menu Pin
David Crow28-Sep-04 5:36
David Crow28-Sep-04 5:36 
GeneralRe: CD rom Context menu Pin
anandforu6-Oct-04 8:56
anandforu6-Oct-04 8:56 
GeneralRe: CD rom Context menu Pin
David Crow6-Oct-04 9:10
David Crow6-Oct-04 9:10 
GeneralActiveX Controls Pin
anandforu28-Sep-04 2:45
anandforu28-Sep-04 2:45 
GeneralCreateProcess puzzle Pin
ns28-Sep-04 1:47
ns28-Sep-04 1:47 
I am launching off a console app (by pressing a button )using CreateProcess. I save the handle to this process and when I press the button again, I want to terminate the process if its already running and relaunch it. I put in debugging statements and indeed I get the expected correct output, but the console window is nowhere to be seen this second time around!
if(m_serverProcessInfo.hProcess)
{
    TerminateProcess(m_serverProcessInfo.hProcess, 0);
    if(fpLog)fprintf(fpLog, "Terminated server\n");
    m_serverProcessInfo.hProcess = 0;
}


int res = StartServer();


and

int CPMA2000Dlg::StartServer()
{
	int res = 0; 
	STARTUPINFO StartupInfo; //This is an [in] parameter
	ZeroMemory(&StartupInfo, sizeof(StartupInfo));
	StartupInfo.cb = sizeof StartupInfo ; //Only compulsory field
 
	StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
       // set the window display to SHOW
  
	StartupInfo.wShowWindow = SW_SHOW;

	if(CreateProcess( m_sPath + "fileserver.exe", NULL, 
		NULL,NULL,FALSE,0,NULL,
		NULL,&StartupInfo,&m_serverProcessInfo))
	{ 
	if(fpLog)fprintf(fpLog, "Started server\n");
        }


My logs:

Started server<br />
Terminated server<br />
Started server<br />


The first time I do see the console window (server.exe) but the second time though CreateProcess() succeeds again, I dont see the console window which disappeared at the TerminateProcess().

How shall I proceed to figure out the problem?
Thanks,
sb
GeneralRe: CreateProcess puzzle Pin
Antony M Kancidrowski28-Sep-04 1:55
Antony M Kancidrowski28-Sep-04 1:55 
GeneralRe: CreateProcess puzzle Pin
ns28-Sep-04 3:04
ns28-Sep-04 3:04 
GeneralRe: CreateProcess puzzle Pin
Antony M Kancidrowski28-Sep-04 6:02
Antony M Kancidrowski28-Sep-04 6:02 
GeneralRe: CreateProcess puzzle Pin
ns28-Sep-04 6:56
ns28-Sep-04 6:56 
GeneralRe: CreateProcess puzzle Pin
Antony M Kancidrowski29-Sep-04 0:34
Antony M Kancidrowski29-Sep-04 0:34 
GeneralRe: CreateProcess puzzle Pin
ns29-Sep-04 1:16
ns29-Sep-04 1:16 
GeneralRe: CreateProcess puzzle Pin
Antony M Kancidrowski30-Sep-04 12:32
Antony M Kancidrowski30-Sep-04 12:32 
GeneralMedia Player Mini-Mode Pin
Dave Moran28-Sep-04 1:26
Dave Moran28-Sep-04 1:26 
GeneralRe: Media Player Mini-Mode Pin
Antony M Kancidrowski28-Sep-04 2:04
Antony M Kancidrowski28-Sep-04 2:04 
GeneralRe: Media Player Mini-Mode Pin
Dave Moran28-Sep-04 13:50
Dave Moran28-Sep-04 13:50 
GeneralRe: Media Player Mini-Mode Pin
Antony M Kancidrowski29-Sep-04 0:38
Antony M Kancidrowski29-Sep-04 0:38 
QuestionHow Can I making database project? Pin
Majid Shahpouri28-Sep-04 1:03
Majid Shahpouri28-Sep-04 1:03 
AnswerRe: How Can I making database project? Pin
GermanGeorge28-Sep-04 4:07
GermanGeorge28-Sep-04 4:07 
Generalwhile loop in threads Pin
ledallam28-Sep-04 0:40
ledallam28-Sep-04 0:40 
GeneralRe: while loop in threads Pin
Manfred Staiger28-Sep-04 1:06
Manfred Staiger28-Sep-04 1:06 
GeneralRe: while loop in threads Pin
Aamir Butt28-Sep-04 1:25
Aamir Butt28-Sep-04 1:25 
GeneralRe: while loop in threads Pin
Blake Miller28-Sep-04 4:30
Blake Miller28-Sep-04 4:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.