yogesh patel
yogesh patel

Reputation: 375

how can i get browse handle of window in visual c++

I am developing automated testing tool type application in which it get window handle and get all button from that application and display in my application and send message to all button randomly all is working good but problem with browse button. when it send message to the browse button it open browse file dialog box and now i want to select file randomly when it click browse button which are shown in that dialog but i don't know how to make this possible?

so please any one can help me or give any simple example for this. i am new in visual c++ and windows API

Thanks.

Upvotes: 0

Views: 899

Answers (1)

selbie
selbie

Reputation: 104579

Call EnumChildWindows. For each HWND that is passed to your callback function, call GetWindowText to discover the title of the window. The one labeled "Open" is the file-open dialog.

You should also get familiar with Spy++ and it's search feature. This is a tool that comes with Visual Studio (and presumably VC++ distributions - or get it as a seperate download). It allows you to click on any window to discover it's properties - included class name, window styles, child windows, and parent window. Very useful for figuring out the parent/child relationship of various windows and buttons.

Also, in most legacy apps, each edit box, button, and ui widget is it's own HWND. Newer apps may not have their UI widgets as child windows. In that case, you need to look at using Windows Accessibility APIs and Windows UI Automation APIs.

Upvotes: 3

Related Questions