Click here to Skip to main content
16,005,339 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Menu Bars or Tool Bars Display Pin
Hamid_RT4-Sep-06 9:16
Hamid_RT4-Sep-06 9:16 
QuestionProblem in DDX Pin
sheshidar3-Sep-06 20:50
sheshidar3-Sep-06 20:50 
AnswerRe: Problem in DDX Pin
Hamid_RT3-Sep-06 22:19
Hamid_RT3-Sep-06 22:19 
GeneralRe: Problem in DDX Pin
sheshidar4-Sep-06 1:08
sheshidar4-Sep-06 1:08 
GeneralRe: Problem in DDX Pin
sheshidar4-Sep-06 2:44
sheshidar4-Sep-06 2:44 
GeneralRe: Problem in DDX Pin
Hamid_RT4-Sep-06 9:34
Hamid_RT4-Sep-06 9:34 
QuestionHow to identify a *.exe file is running in OS using VC++ Pin
sujeet_kulk3-Sep-06 20:29
sujeet_kulk3-Sep-06 20:29 
AnswerRe: How to identify a *.exe file is running in OS using VC++ Pin
Programm3r3-Sep-06 21:01
Programm3r3-Sep-06 21:01 
	<br />
HANDLE h_pro;<br />
	HANDLE h_sna;<br />
	PROCESSENTRY32 pe_sen = {0};<br />
<br />
	int result;<br />
	bool returnValue;<br />
	bool counter = false;<br />
<br />
	char* ProcessNames = appName; //Where appName is the name of the application - notepad.exe.<br />
<br />
	h_sna = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);<br />
	if (h_sna == INVALID_HANDLE_VALUE){<br />
		returnValue = false;<br />
		return (returnValue);<br />
	}<br />
<br />
	pe_sen.dwSize = sizeof(PROCESSENTRY32);<br />
<br />
	try{<br />
		if (Process32First(h_sna, &pe_sen))<br />
		{<br />
			do<br />
			{<br />
				h_pro = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pe_sen.th32ProcessID);				<br />
				CloseHandle (h_pro);<br />
<br />
				if (pe_sen.th32ProcessID != 0)<br />
				{<br />
					//compare the name giving with all active processes<br />
					result = strcmp (pe_sen.szExeFile,ProcessNames);<br />
<br />
					if(result > 0){						<br />
						//Not found <br />
						returnValue = false;<br />
					}<br />
					else if (result < 0){						<br />
						//Not Found<br />
						returnValue = false;<br />
					}<br />
					else<br />
					{<br />
						//found occurrence of the process<br />
						globalVariable = pe_sen.th32ProcessID;<br />
						counter = true;<br />
					}<br />
				}<br />
			} while (Process32Next(h_sna, &pe_sen));<br />
		}	<br />
	}<br />
	catch(...)<br />
	{		<br />
		//if any exception occured - return false<br />
		returnValue = false;<br />
	}<br />
<br />
	//testing the return code<br />
	if (counter)<br />
		return counter;<br />
	return returnValue;<br />
<br />
	//close the process handle<br />
	CloseHandle (h_sna);<br />


Regards

Programm3r

JokeRe: How to identify a *.exe file is running in OS using VC++ Pin
Programm3r3-Sep-06 21:07
Programm3r3-Sep-06 21:07 
GeneralRe: How to identify a *.exe file is running in OS using VC++ Pin
sujeet_kulk3-Sep-06 22:44
sujeet_kulk3-Sep-06 22:44 
QuestionRe: How to identify a *.exe file is running in OS using VC++ Pin
Programm3r3-Sep-06 21:42
Programm3r3-Sep-06 21:42 
AnswerRe: How to identify a *.exe file is running in OS using VC++ Pin
Hamid_RT3-Sep-06 22:10
Hamid_RT3-Sep-06 22:10 
GeneralRe: How to identify a *.exe file is running in OS using VC++ Pin
sujeet_kulk3-Sep-06 22:53
sujeet_kulk3-Sep-06 22:53 
QuestionGlobal variable between projects of same workspace Pin
kk_mfc3-Sep-06 19:40
kk_mfc3-Sep-06 19:40 
AnswerRe: Global variable between projects of same workspace Pin
Waldermort3-Sep-06 20:41
Waldermort3-Sep-06 20:41 
AnswerRe: Global variable between projects of same workspace Pin
_AnsHUMAN_ 3-Sep-06 21:31
_AnsHUMAN_ 3-Sep-06 21:31 
QuestionIcon information Pin
Sgg2453-Sep-06 19:10
Sgg2453-Sep-06 19:10 
Questionhow to import own icon Pin
gentleguy3-Sep-06 17:51
gentleguy3-Sep-06 17:51 
AnswerRe: how to import own icon Pin
_AnsHUMAN_ 3-Sep-06 18:05
_AnsHUMAN_ 3-Sep-06 18:05 
AnswerRe: how to import own icon Pin
Fired Fish3-Sep-06 18:30
Fired Fish3-Sep-06 18:30 
GeneralRe: how to import own icon Pin
toxcct4-Sep-06 5:00
toxcct4-Sep-06 5:00 
Questiondialog Pin
Duc Quang3-Sep-06 16:57
Duc Quang3-Sep-06 16:57 
AnswerRe: dialog Pin
velayudhan_raj3-Sep-06 17:05
velayudhan_raj3-Sep-06 17:05 
AnswerRe: dialog Pin
Mahesh Kulkarni3-Sep-06 18:44
Mahesh Kulkarni3-Sep-06 18:44 
AnswerRe: dialog Pin
Steve Echols3-Sep-06 19:45
Steve Echols3-Sep-06 19:45 

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.