Getting handle of an active dialog window

E

Ewgenij Sokolovski

Hello, all. Currently, I write a tool, which clicks through Outlook
2007 automatically. I have selected the inbox of one of my accounts.
Then I clicked on "View" in the main outlook bar. Then I clicked on
"Current View" in the opened command bar. Then I clicked on "Customize
current view" in the new opened command bar. Everything worked so far.
But after the last click a dialog window opened. I want to click a
button on that dialog window. But how can I get a handle on it???
Application.ActiveWindow did not lead to the wanted result:(((

BR
Ewgenij
 
E

Ewgenij Sokolovski

Hmm, and will I be able to access any checkboxes on the window through
this handle? I mean, the handle will be probably a common window
handle without any knowledge of the inner window structure... And I do
not have the source of the actual window class of that window, so I
can not cast the handle.

BR
Ewgenij
 
D

Dmitry Streblechenko

You will need to enumerate the child windows of that dialog to find the
checkbox tha tyou need.
I would strongly discourage you from doign anything like that - you will
have nothing but problems, especially when you run under versions of Outlook
th tuse a different locale or if MS redesigns the dialog.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
E

Ewgenij Sokolovski

You will need to enumerate the child windows of that dialog to find the
checkbox tha tyou need.

Aha, enumerate:) But I need a handle to a checkbox I want to set or
unset. What do you mean by "enumerate"? Supposed I got the main window
handle "hwnd". What should I do next?
I would strongly discourage you from doign anything like that - you will
have nothing but problems, especially when you run under versions of Outlook
th  tuse a different locale or if MS redesigns the dialog.

Actually, I have to write a tool for a predefined version of Outlook,
so I do not care about any modifications or variations.

BR
Ewgenij

P.S. Do I have any other ways to set a couple of Outlook options
automatically? I succeeded with some of them through the registry, but
some other are not saved in the registry. So the only way I see is to
click automatically through Outlook:((
 
M

Michael Bauer [MVP - Outlook]

A tool like Spy++ shows you the structure of windows. You can enumerate with
the API function GetWindow and some commands like: GW_HWNDFIRST,
GW_HWNDLAST, etc.

I agree with Dmitry, you should really know what you do.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>



Am Mon, 15 Dec 2008 02:47:19 -0800 (PST) schrieb Ewgenij Sokolovski:
 

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