I have a C++ app that makes use of a Webbrowser component. When a certain URL is open I get an standard Script Error dialog. I inspected the dialog and found out its type is *Internet Explorer_TridentDlgFrame*.
What I need to do is to close that dialog window. I already added a Window Hook and on the
WM_SHOWWINDOW I compare the title of the window and close it by sending a WM_CLOSE message.
The problem with that approach is that I cannot distinguish this window from other windows with the same title. So, What I'd need to do is to be able to access the text and the buttons in the
*Internet Explorer_TridentDlgFrame* dialog, in order to filter using its text and then click its Yes button.
I know how to get the child components from standard dialogs but I do not how to do it with this *Internet Explorer_TridentDlgFrame* dialog type. When I inspect it with WinSpy I can see that all the visual elements inside this dialog are encapsulated in *Internet Explorer_Server* element.
Does someone know how to access the visual components on the *Internet Explorer_TridentDlgFrame* dialog?
Thanks in advance for your help!
Related
I want to log the messages of this menu using Spy++.
Usually, if I want to log the messages of a window, I would use Spy++ and drag the "Find Window" tool over it. But in this case, if I drag the tool over this menu, the menu disappears because I clicked outside it.
Is there any workaround to this?
A little more information:
What I want to achieve is finding out what messages are sent when I click the menu's items (they are buttons).
That particular menu in the first picture is created only when I click the button, and it has a different HWND every time I click it.
If I can't accomplish this in Spy++, can I do this using some other application similar to Spy++?
Actually I figured it out myself.
You can just log messages of the parent window with the logging options set to also log messages of child windows.
I am trying to build an MFC application Dialog based application. It runs ok. But I need to insert another Dialog. So how can I for example, pressing on a button from the first dialog to open the new added dialog?.
I am using Microsoft Visual Studio 2015.
I right clicked on the resources folder and insert a dialog.
It is inserted, but how to create it?.
Thank you.
The easiest way is: I consider you are creating a Dialog based application so you get a main Dialog box and an About Dialog box when Selecting menu->About.
To add Another Dialog to your application:
1- Right click on the solution explorer on the resources files and select Add->Resource->Dialog->New
You get a new Dialog right front of you. Right click on this Dialog and select Add Class. give it for example a name like "MyDlg2" and click ok.
You'll see two files added: MyDlg2.h and MyDlg2.cpp.
Now How to Popup this second dialog (MyDlg2)? Let's create a button on the main Dialog:
Drag a button onto Main Dialog.
Give it a caption "Gong to Dialog2..."
Double-click this button to add a handler for it.
In this handler enter:
MyDlg2 dlg;
dlg.DoModal();
Scroll to the top of this file and add:
#include "MyDlg2.h"
This is important so that main Dialog knows How to create dialog 2.
Build and run.
You need to derive a class from CDialog.
For more information check this MSDN example.
I seem to have the original problem from Embedded Modeless Child Dialog not getting messages. I have managed to add rows to my property page using tips form What is the best way to manage data for rows of similar controls in MFC? but now when I click on the controls in the embedded dialog, nothing happens. I assume there's some message routing I need to do in the parent dialog but I don't know what it is.
The properties of the row dialog resource included Disabled = True. I have no idea how that happened.
My application is a dialog shipped out as a dll. It can be launched in modal and modeless modes,from a bigger application that I have no control of. We use MFC library and follows COM architecture. For development purpose we have a tester application that launches my dialog.
The problem I face is that tab key do not work at all in both modal and modeless.
but, arrow keys work.
When observed through SPY++, I cannot see tabs coming to my dialog at all.
I am pretty confused on what's happening ?
For tabs to work in a modeless dialog, the application must call IsDialogMessage from its main message pump. But in your case, the application doesn't even know the dialog exists. I believe your only option is to install a Windows hook (see SetWindowsHookEx) and call IsDialogMessage yourself.
Modal dialog should work out of the box though - are you sure it doesn't?
I have a dynamically created toolbar on a plain Win32 dialog. My buttons are added with & shortcuts which correctly puts underscore to characters following ampersand but pressing Alt+(char) causes a beep and the button is not clicked.
It has been a while since I have done Win32 API development. Is there something that needs to be done to a dynamically created child window (toolbar) in order for the accelerator keys to work?
This could be something really obvious that I am missing...
Well... You have to write code to handle these keypresses and convert them into WM_COMMAND messages. The traditional way to do this is to define an accelerator table and process them using TranslateAccelerator() - but of course, you're free to do it however you like... Just make sure the keys you handle jibe with the keys you underline!
You might also find this KB article helpful: How to use accelerator keys within a modal dialog box in Visual C++... Or, for a more in-depth (and MFC-free) look at implementing custom message processing in dialogs, check out Raymond Chen's articles on the dialog manager, specifically part 4: The dialog loop and part 9: Custom accelerators in dialog boxes (but seriously, read the whole thing, you know you want to...)
The beep indicates that the command isn't handled by any window in your app.
Since you created the toolbar dynamically, I would guess that the toolbar window isn't set up properly as a child window of your main window (i.e., it's parent and owner window are not set).
To test: click on the toolbar so it has the focus, then press Alt- and it should work.