how can i check whether notepad.exe is running in taskmanager or not
-
-
Hi, I want to findout whether notepad.exe is running in taskmanager or not. if i create a process to open notepad.exe then i can find process id and close it, but i am not opening notepad.exe through process. pls help me, waiting 4 ur reply bye trinadh
Here is an example...
#include <windows.h>
#include <stdio.h>
#include "psapi.h"void PrintProcessNameAndID( DWORD processID )
{
char szProcessName[MAX_PATH] = "unknown";// Get a handle to the process. HANDLE hProcess = OpenProcess( PROCESS\_QUERY\_INFORMATION | PROCESS\_VM\_READ, FALSE, processID ); // Get the process name. if (NULL != hProcess ) { HMODULE hMod; DWORD cbNeeded; if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), &cbNeeded) ) { GetModuleBaseName( hProcess, hMod, szProcessName, sizeof(szProcessName) ); } else return; } else return; // Print the process name and identifier. printf( "%s (Process ID: %u)\\n", szProcessName, processID ); CloseHandle( hProcess );
}
void main( )
{
// Get the list of process identifiers.DWORD aProcesses\[1024\], cbNeeded, cProcesses; unsigned int i; if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) ) return; // Calculate how many process identifiers were returned. cProcesses = cbNeeded / sizeof(DWORD); // Print the name and process identifier for each process. for ( i = 0; i < cProcesses; i++ ) PrintProcessNameAndID( aProcesses\[i\] );
}
Love Forgives--Love Gives--Jesus is Love :)
--Owner Drawn --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord
-
Here is an example...
#include <windows.h>
#include <stdio.h>
#include "psapi.h"void PrintProcessNameAndID( DWORD processID )
{
char szProcessName[MAX_PATH] = "unknown";// Get a handle to the process. HANDLE hProcess = OpenProcess( PROCESS\_QUERY\_INFORMATION | PROCESS\_VM\_READ, FALSE, processID ); // Get the process name. if (NULL != hProcess ) { HMODULE hMod; DWORD cbNeeded; if ( EnumProcessModules( hProcess, &hMod, sizeof(hMod), &cbNeeded) ) { GetModuleBaseName( hProcess, hMod, szProcessName, sizeof(szProcessName) ); } else return; } else return; // Print the process name and identifier. printf( "%s (Process ID: %u)\\n", szProcessName, processID ); CloseHandle( hProcess );
}
void main( )
{
// Get the list of process identifiers.DWORD aProcesses\[1024\], cbNeeded, cProcesses; unsigned int i; if ( !EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded ) ) return; // Calculate how many process identifiers were returned. cProcesses = cbNeeded / sizeof(DWORD); // Print the name and process identifier for each process. for ( i = 0; i < cProcesses; i++ ) PrintProcessNameAndID( aProcesses\[i\] );
}
Love Forgives--Love Gives--Jesus is Love :)
--Owner Drawn --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord
-
thanks for giving me reply, i try this code if i get any doubt i get back to u. bye trinadh
Thanks to MSDN
Love Forgives--Love Gives--Jesus is Love :)
--Owner Drawn --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord
-
Thanks to MSDN
Love Forgives--Love Gives--Jesus is Love :)
--Owner Drawn --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord
:laugh:
-
:laugh:
Error:Cannot open include file: 'psapi.h': Vikas Amin Embin Technology Bombay vikas.amin@embin.com
-
Error:Cannot open include file: 'psapi.h': Vikas Amin Embin Technology Bombay vikas.amin@embin.com
-
Error:Cannot open include file: 'psapi.h': Vikas Amin Embin Technology Bombay vikas.amin@embin.com
For header files other than my own, I use angle brackets <> instead of quotes. In any case, does the file exist on your machine?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb