Link to home
Start Free TrialLog in
Avatar of npaun
npaun

asked on

How to get a handle to a Word document window?

Suppose you have VB6 connected to a created Word document, or as a Word add-in, or from VBA, anyway, you have access to the Word.Application and Word.Document objects.
How to get a handle to the Word document window , but without using something like FindWindow and then searching for a window with a specific title or class name? Does Word expose it somewhere? I don't trust in FindWindow, as several documents can have the same document title/caption...
Avatar of James Elliott
James Elliott
Flag of United Kingdom of Great Britain and Northern Ireland image

Excel has an hwnd property under Excel.Application. I do not believe Word does, so I think you're limited to API calls that you want to avoid.
SOLUTION
Avatar of James Elliott
James Elliott
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ooops sorry - posted a suggestion using FindWindow... read the Q on my phone so missed that.  

Anyway, appreciate that Find Window can have many windows with the same name.  I guess you could find the first instance of the window (change the name) then look for a 2nd instance and so on... you could also, presumably, interrogate the object for some other known properties?
Avatar of npaun
npaun

ASKER

...
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial