Click here to Skip to main content
16,007,932 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WM_KILLFOCUS Pin
NC16-Aug-02 7:22
NC16-Aug-02 7:22 
GeneralRe: WM_KILLFOCUS Pin
PJ Arends16-Aug-02 14:58
professionalPJ Arends16-Aug-02 14:58 
GeneralRe: WM_KILLFOCUS Pin
NC19-Aug-02 1:49
NC19-Aug-02 1:49 
QuestionIs there a way to see if a SOCKET is connected? Pin
Le centriste16-Aug-02 4:40
Le centriste16-Aug-02 4:40 
AnswerRe: Is there a way to see if a SOCKET is connected? Pin
Masaaki Onishi16-Aug-02 7:21
Masaaki Onishi16-Aug-02 7:21 
Questionhow to idenitify whether process is running or not Pin
tongc16-Aug-02 3:58
tongc16-Aug-02 3:58 
AnswerRe: how to idenitify whether process is running or not Pin
Tomasz Sowinski16-Aug-02 4:04
Tomasz Sowinski16-Aug-02 4:04 
GeneralRe: how to idenitify whether process is running or not Pin
tongc16-Aug-02 6:04
tongc16-Aug-02 6:04 
this is to monitor if the processes are running or not? It is just an excercise to get myselft familiar with Win32 programming.

First i create 5 process namely notepad.exe . Then i have to monitor that how many of these processes are running every 1 second. I've attempted many ways to do it but i failed. This is how i did it.
<br />
void main()<br />
{<br />
//	HANDLE handle;<br />
	STARTUPINFO startUpInfo[5];<br />
	PROCESS_INFORMATION proInfo[5];<br />
	BOOL success;<br />
	HANDLE proHandle[5];<br />
	INT i;<br />
	INT runningProcess = 5;<br />
	CHAR appName[100];<br />
	<br />
	<br />
<br />
	<br />
	strcpy(appName, "c:\\windows\\notepad.exe");<br />
<br />
<br />
	//DWORD status[5];<br />
	<br />
	<br />
	for(i = 0; i <5; i++)<br />
		GetStartupInfo(&startUpInfo[i]);<br />
	<br />
<br />
	//Create process<br />
	for(i = 0; i < 5; i++)<br />
	{<br />
		success = CreateProcess(appName, 0, 0, 0, FALSE, 0, 0,0,&startUpInfo[i], &proInfo[i]);<br />
		<br />
		if(!success)<br />
			cout <<" Error creating process: "<< GetLastError() <<endl;<br />
		<br />
		cout << "The process ID is " << proInfo[i].dwProcessId << endl;<br />
	}<br />
<br />
	for(i = 0; i <5; i++)<br />
	{<br />
		proHandle[i] = proInfo[i].hProcess;<br />
	}<br />
<br />
while (WaitForMultipleObjects(5, proHandle, TRUE, 1000) == WAIT_TIMEOUT)<br />
	{<br />
		for(i = 0; i < 5; i++)<br />
		{<br />
			if(proInfo[i].hProcess == NULL)<br />
				runningProcess--;<br />
<br />
		}<br />
		<br />
	<br />
		printf(" %d ", runningProcess);		 <br />


I know that this code may look silly to some of you but instead of laughing, please guide me to the right direction. Thanks
GeneralRe: how to idenitify whether process is running or not Pin
Tomasz Sowinski16-Aug-02 7:04
Tomasz Sowinski16-Aug-02 7:04 
GeneralRe: how to idenitify whether process is running or not Pin
Daniel Lohmann16-Aug-02 13:10
Daniel Lohmann16-Aug-02 13:10 
GeneralRe: how to idenitify whether process is running or not Pin
tongc16-Aug-02 13:51
tongc16-Aug-02 13:51 
GeneralRe: how to idenitify whether process is running or not Pin
tongc16-Aug-02 14:57
tongc16-Aug-02 14:57 
GeneralRe: how to idenitify whether process is running or not Pin
tongc16-Aug-02 15:02
tongc16-Aug-02 15:02 
GeneralDefinition of Serialization Pin
Nick Parker16-Aug-02 3:56
protectorNick Parker16-Aug-02 3:56 
GeneralRe: Definition of Serialization Pin
Tomasz Sowinski16-Aug-02 4:08
Tomasz Sowinski16-Aug-02 4:08 
GeneralRe: Definition of Serialization Pin
Nick Parker16-Aug-02 4:20
protectorNick Parker16-Aug-02 4:20 
GeneralRe: Definition of Serialization Pin
Tomasz Sowinski16-Aug-02 4:29
Tomasz Sowinski16-Aug-02 4:29 
GeneralRe: Definition of Serialization Pin
Nick Parker16-Aug-02 4:38
protectorNick Parker16-Aug-02 4:38 
GeneralRe: Definition of Serialization Pin
Tomasz Sowinski16-Aug-02 4:44
Tomasz Sowinski16-Aug-02 4:44 
GeneralRe: Definition of Serialization Pin
Nick Parker16-Aug-02 4:47
protectorNick Parker16-Aug-02 4:47 
GeneralRe: Definition of Serialization Pin
Daniel Lohmann16-Aug-02 13:34
Daniel Lohmann16-Aug-02 13:34 
Generalado clone - some questions Pin
ns16-Aug-02 3:43
ns16-Aug-02 3:43 
GeneralKeeping the values in controls when closing and opening a Dialog Pin
Luis E. Cuadrado16-Aug-02 3:40
Luis E. Cuadrado16-Aug-02 3:40 
GeneralRe: Keeping the values in controls when closing and opening a Dialog Pin
mishgun16-Aug-02 3:43
mishgun16-Aug-02 3:43 
GeneralRe: Keeping the values in controls when closing and opening a Dialog Pin
Tomasz Sowinski16-Aug-02 3:46
Tomasz Sowinski16-Aug-02 3:46 

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.