Thursday, 1 September 2011

How to get application process ID for ms-word

Hi, I used to do lot of work on the Microsoft word application where I come up with process id. I want to know my process id for my Microsoft word application. The MS-Word applications are identify upon by my some other application except my visual c application when I try to use it in the same machine. Does anyone what may be the reason of this problem and how to persist it as I had tried many things but not anything had help me out.
For more useful tips & hints, please browse for more information at our website:-
Silverstone Fortress
Secret Files
I don’t know much about it and had a made a bit search regarding your problem but dint come up with much things. You should try to use the toolhlp library in that use CreateToolhelp32Snapshot(...) and then try Process32First(...) and then Process32Next(...). You should even try few sample code which is given in the MSDN which id under the CreateToolHelp32Snapshot API help. Hope this will help you to get clear from tour problem.

Even I was having the same problem with the visual c and when I try to compile the source code I came up with a compile error. The source code through an error message is given below:-
Code:

#include
#include
#include
BOOL Getcourserecord ()
{
HANDLE hcourse= NULL;
BOOL ar = FALSE;
PROCESSENTRY32 p32 = {0};
hcourse = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);

if (hcourse == INVALID_HANDLE_VALUE)
return (forged);
p32.dwSize = sizeof(PROCESSENTRY32);
if (Process32First(hcourse, & p32))
{
DWORD dwPriorityClass;
BOOL getm = FALSE;
MODULEENTRY32 me32 = {0};
do
{
getm = GetProcessModule(p32.th32ProcessID,
p32.th32ModuleID, &me32, sizeof(MODULEENTRY32));
if (getm)
{
HANDLE hProcess;
hProcess = OpenProcess (PROCESS_ALL_ACCESS,
FALSE, p32.th32ProcessID);
dwPriorityClass = GetPriorityClass (hProcess);
CloseHandle (hProcess);
printf( "\n precedence group \t%d\n",
p32.pcPriClassBase);
printf( "PID123\t\t\t%d\n", p32.th32ProcessID);
printf( "Thread calculate\t\t%d\n", p32.cntThreads);
printf( "Module given name\t\t%s\n", me32.szModule);
printf( "Full pathway\t\t%s\n\n", me32.szExePath);
}
}
while (Process32Next(hProcessSnap, & p32));
ar = right;
}
else
ar = forged; CloseHandle (hcourse);
return (ar);
}
int main (int argc, char** argv)
{
Getcourserecord ();
return 0;
}

is showing an error c2065 and says undeclared identifier
You must see the example code which is given is MSDN for the Module32First(...) which is having the an example of code GetProcessModule which in turn given in the function and you don’t required an GetProcessModule piece so just create the snap short for the process32first and the process32last as the LPPROCESSENTRY32 lppe is previously having the method name. That code will surely work for you and if you still face the same issue then search for it on net.

I had seen your code and even go through the instruction given to me but after that I started facing the different problem when I’m trying to open an WINWORD windowsi was not able to see anything on it beside only one process with an name wWINWORD which is from the console output and I was even able to see many process of IEXPLORE.EXE which came from the console output in different IE WINDOW does anyone know why this is happening.

No comments:

Post a Comment