It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

Getting handle subwindow Word document, STRANGE BEHAVIOR

Moderator: dafunkymunky

Getting handle subwindow Word document, STRANGE BEHAVIOR

Postby lvermeersch on Tue Dec 13, 2005 9:11 am

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

Code: Select all
Hendel = FindWIndowEx(0,0,"bosa_sdm_Microsoft Word 10.0","")



Should i use an other API, to look for the submenu class or am i doing something wrong.
Allso i don't want to use the caption window title to look for the window, i want to use the class because i wan to test if any subwindow is open.
Last edited by lvermeersch on Fri Dec 16, 2005 2:32 pm, edited 1 time in total.
lvermeersch
 
Posts: 13
Joined: Thu Aug 25, 2005 9:30 am

Postby lvermeersch on Fri Dec 16, 2005 2:31 pm

The first problem was in one of the string parameters.
So i use now:
Hendel = FindWIndowEx(0,0,"bosa_sdm_Microsoft Word 10.0", vbNullString)
This mostly works. I explain:


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.


Private SUb Timer1_Timer()
Static Tel as Long
Dim Hendel as Long
tel = tel + 1
text22.text = tel
Hendel = FindWIndowEx(0,0,"bosa_sdm_Microsoft Word 10.0", vbNullString)
...
end sub
lvermeersch
 
Posts: 13
Joined: Thu Aug 25, 2005 9:30 am


Who is online

Users browsing this forum: No registered users and 4 guests