|
C:\Users\katek\Desktop\GetProcessIDs_src\GetProcessIDTest.o:GetProcessIDTest.cpp|| undefined reference to `GetProcessID(char const*, std::vector<unsigned long,="" std::allocator<unsigned="" long=""> >&)'|
end code
http://wklej.org/id/596342/txt/[^]
|
|
|
|
|
Hello,
I have an application (A) that starts an out-of-proc server(SERVER). When I start a second instance of my application, a second out-of-proc server is created.
The question is how I can get the PID of the server from my application.
To be more specific, I have a monitor application (M)(a third executable) that monitor the instances of my applications A. The user can decide to kill one of the instances of A (let's say A1), but the SERVER launched by A1 is not killed.
The most elegant way it is to send a message from M to A1 to shut it down - but I dont have this message - and it is too complex to change it now.
Other way it is to: M launches A1, and wait until the first instance of SERVER is created, (by listing all active processes) and get the PID of the SERVER. Then when M launches the second application A2, to do the same. In this way I can get the PID of each SERVER "associated" with Ax. This method is not very elegant
Thanks in advance,
Razvan
|
|
|
|
|
How to get the no. of GDI objects used for a running process with given process ID which is displayed in task manager using mfc
|
|
|
|
|
How to get the handle count of a running process with given process ID using mfc
|
|
|
|
|
hi friends..
Can i get the name of exe which is running foreground...
For example when plalying counter strike, czero.exe is running..How can i get the name 'czero.exe'...?
I am working in vc++
-- modified at 8:37 Monday 23rd October, 2006
|
|
|
|
|
|
.. the previous version of this source that I'd downloaded a couple of years ago didn't have this, and it was starting to be a real pain because of multiple instances using same EXE name. Nice one. Where do you find the info on this stuff?, I could never figure out how to add the ID version because of lack of documentation.
thx again.
|
|
|
|
|
Dear All,
Can anybody let me know how to kill the running process (In WINDOWS SDK)???
I am using the TerminateProcess() functionin which it requires the Handle of the process...How do I get the handle of process ??? Let me tell U,I am not getting the required Output by GetHandle() method...
Thanks in advance.
Supriya Tonape
|
|
|
|
|
Hello,
Here is the sample code to terminate Notepad application...
==========================
HANDLE snapshot;
PROCESSENTRY32 process_entry;
snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (snapshot == INVALID_HANDLE_VALUE)
return false;
process_entry.dwSize = sizeof(PROCESSENTRY32);
BOOL success = Process32First(snapshot, &process_entry);
DWORD pid;
const char program[] = "notepad.exe";
while (success)
{
if (_strnicmp(program, process_entry.szExeFile, sizeof(process_entry.szExeFile)) == 0)
{
// is running.
pid = process_entry.th32ProcessID;
break;
}
success = Process32Next(snapshot, &process_entry);
}
DWORD exitCode;
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
if (hProcess)
{
if (::GetExitCodeProcess(hProcess, &exitCode))
{
::TerminateProcess(hProcess, exitCode);
}
}
===========================
regards,
Ameen
|
|
|
|
|
will this woork on UNIX? if no, can you suggest some code for UNIX platform
Thanks in advance
vish
|
|
|
|
|
will this work on UNIX? if no, can you suggest some code for UNIX platform
Thanks in advance
vish
|
|
|
|
|
Hello.
What is the diffrence between process id and process handle and your code gime me which of this and how to change thease to each other?
|
|
|
|
|
Hello
How can I get the process ID of process ( application ) which is in foreground ? I used GetForegroundWindow() and GetWindowThreadProcessId() to get the process ID. But GetWindowThreadProcessId returns me the same PID each time. ( It returns me the PID of explorer.exe each time )
What can I do to get the correct process ID ?
Ajay
|
|
|
|
|
Well, if you know the process name then pass it as the argument to my utility.
|
|
|
|
|
Hey
I'm reading about HKEY_PERFORMANCE_DATA key in MSDN, and it is clearly said that :: be sure to use the RegCloseKey function to close the handle to the key when you are finished obtaining performance data. The user cannot install or remove a software component while its performance data is in use.
Is there any reason why you aren't closing that handle.
I Hate Win98
|
|
|
|
|
Thanks Mr Avramov. You fixed it very fast..
|
|
|
|
|
Well, it is strange because i fixed that in 19.9.2003 (See in Updates section in my article).
However, thanks for letting me know.
|
|
|
|
|
Hi,
I need to get the owner name and pid of all process running in NT4.
I will appreciate a lot if you can provide me a hint.
Thanking you,
Kuntal Mondal
|
|
|
|
|
|
Is this code thread safe cause I am having access denied error while two thread is trying to access the code?
Could you help me to get it thread safe? thanks.
|
|
|
|
|
Anyway I solved the problem by CCriticalSection and CSingleLock.
|
|
|
|
|
WMI is native for Win2000/XP.
It also works for Win95/98/NT4 after installing WMICore.
WMI has WQL - the language with great possibility of
creating query. And WMI accessible for C++, C#, Java,
Delphi, VB, Windows Script.
|
|
|
|
|
Hi,
I'd like to use your application, but...
It takes several seconds on my P4 2.0 Ghz to give me the answer.
Do you have the same performance on your system. Any idea to improve speed?
Thanks,
Arnaud
|
|
|
|
|
I dont have that problem.
Check whether there are many memory re-allocations in the following loop:
while( (lRes = RegQueryValueEx( HKEY_PERFORMANCE_DATA,
"Global",
NULL,
NULL,
(LPBYTE) pPerfData,
&BufferSize )) == ERROR_MORE_DATA )
{
BufferSize += BYTEINCREMENT;
pPerfData = (PPERF_DATA_BLOCK) realloc( pPerfData, BufferSize );
}
If there are, then change the TOTALBYTES and BYTEINCREMENT values.
I hope it will help you.
|
|
|
|
|
When I use NT Performance Monitor in my computer, I cann't see the performance object "Process" and "Thread"! Do you know what's wrong with my win2k system? Os is Microsoft windows 2000, version: 5.00.2195, Service Pack 3.
Every is my teacher!(From China saying )
|
|
|
|