There are many possible dialogs. MessageBox and shell dialogs such as OpenFileDialog, PrintDialog, ColorDialog, etc. are standard. Many non-standard ones, such that a programmer who uses his own code to write a Windows program, are created using the resource editor. Displayed by winapi DialogBox () function.
You will need to learn more about the dialog box, use the Spy ++ utility . If this is a general dialog, you will see that each control in the window has an identifier. You find them back at runtime by calling GetDlgItem (). EnumChildWindows () may be required if they are nested in another child window. If the function does not work, returns IntPtr.Zero, then you know that you do not have the dialog box you need. You also need pinvoke GetClassName () to verify that this is the type of control you are hoping to find.
Remember that it can never be 100% accurate; programmers tend to choose identifiers that are very common. How simple it is to number them sequentially, starting with 1. Doing this at the right time, when it is very likely that a particular dialog box is shown, is very important.
And be careful that Microsoft can easily break your code. They do not promise to keep the dialogs in the next version of Internet Explorer.
And be careful, but not least, that programmers are usually interested in this because they want to bother with a hint to confirm the download of the file. Recalling the path name and pressing the OK button automatically. Of course, a very attractive target for malware, they built countermeasures to defeat this easy target. Advanced Protected Mode, included in later versions of IE, is another counter measure that will give you a throbbing headache.
source share