Get The Word Process ID

T

TMS

Hi there

I´ve been trying to get the id of a word application instance launched from
my aplication. I´ve a container (dsoFramer) where I open an word document.

What I want to do is when I open a document inside this frame... I want to
return the Process ID of the word application instance.

This is the code that i´m tryng to work it:

[DllImport("user32")]
public static extern IntPtr FindWindow(
string lpClassName, string lpWindowName);

[DllImport("user32")]
public static extern uint GetWindowThreadProcessId(
IntPtr hWnd, out IntPtr lpdwProcessId);

private AxDSOFramer.AxFramerControl axFramer;

private void CreateDocument()
{
this.axFramer.CreateNew("Word.Document");
uint wPID = GetProcessID();
}

private uint GetProcessID()
{
System.IntPtr ptr = FindWindow("OpusApp", null);
return GetWindowThreadProcessId(ptr, out myDummyPointer);
}

Thanks in advice for any help
 
H

Helmut Weber

Hi,
Say if this is the wrong group!
seems to be so.
You may search microsoft.public.vc.* or
microsoft.public.vc.mfc.docview in particular,
or other C-groups, as your code looks like C to me.
People here usually operate within Word,
if you know what I mean, as I am not a native speaker of English.
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top