|
-
Dec 13th, 2005, 02:16 AM
#1
Thread Starter
Lively Member
Getting handle subwindow Word document, STRANGE BEHAVIOR
I use Word automation in my VB6 Application
I have to get the handle to a subwindow of an open Word document let say the textbox properties window.
I found how to do it but couldn't get the handle (i get allways zero)
I can only get the handle to he parent word document OpusApp.
The code
'I know i have the correct 10.0 version
VB Code:
Hendel = FindWIndowEx(0,0,"bosa_sdm_Microsoft Word 10.0","")
So i get allways zero and i have the submenu 'FormatTexbox' open
I can get the hendle using GetForegrondwindow but, using this method is useless here, because i have to find the window through the open windows not only the foreground or active one.
Should i use an other API, to look for the submenu class or am i doing something wrong.
Last edited by lvermeersch; Dec 16th, 2005 at 09:14 AM.
-
Dec 13th, 2005, 10:37 PM
#2
Re: Getting handle subwindow Word document
You need to pass the found parent window handle (OPusApp) so it knows to look for a child window of that window.
VB Code:
Hendel = FindWIndowEx(WordHandleGoesHere,0,"bosa_sdm_Microsoft Word 10.0","")
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 16th, 2005, 08:33 AM
#3
Thread Starter
Lively Member
Re: Getting handle subwindow Word document
Thx for reply.I can get the handle now most of the time. But sometimes get nothing.
I found a very strange behavior. Problem seems to be an execute stop, the command FindWindowEx seems not the problem.
First my situation.
I have a timer (interval at 50)
In the timer i look for the open subwindow using the FindWindowEx command
The problem seems te be that when i open a Save As window in the open Word document sometimes (in 50% of the case) the timercode stops executing. To check this i add a static counter with a textbox. Often the Tel counter doen'st add but stops until i close the doc subwindow 'Save as', then the counter continues?
What can i do about this. I need to continue my code in the timer when subwindow is open. The same effect when i open subwindow Options or other subwindow. Allso setting a shorter timerinterval doesn't improve
-Allso strange is that when the cursor is in a textbox shape of word doc it does allways work!
When cursor is just in the word document itself and not in a textbox or other object this not allways work and executing often stops until i close the subwindow.
VB Code:
Private SUb Timer1_Timer()
Static Tel as Long
Dim Hendel as Long
tel = tel + 1
text22.text = tel
Hendel = FindWindowEx(...)
end sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|