How do I get messages to embedded dialogs in MFC? - mfc

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.

Related

Drag and drop in MFC Dialog

I'm trying to add drag and drop functionality to a control on a property page which is programmatically "wrapped" inside an MFC dialog at runtime. This "wrapping" involves instantiating the property page as a member of the dialog, and then resizing it and positioning it to the dimensions of a picture control which is on the dialog in the .rc file. I'm not sure why things were done this way, other than to maybe standardise the appearance of property pages in the app, but in any case I end up with this complicated hierarchy of windows, a control inside a property page inside a picture control inside a dialog.
The control which I want to accept dragged files has DragAcceptFiles invoked on it, but I think the WM_DROPFILES message for the control is being discarded before it reaches the control, because one of the parent windows doesn't accept dragged files. I considered calling DragAcceptFiles on all the parents, and passing WM_DROPFILES down the chain of windows, but I don't want to do that because they won't have handlers to accept the files, and will show the icon indicating files can be dropped on them regardless.
Any help on figuring out how to get the WM_DROPFILES message to my control would be much appreciated.
At the parent level, implement an override for virtual CDialog::PreTranslateMessage(MSG* pMsg)
This gives you a chance to see the WM_DROPFILES message and redirect them to a handler in the property page.
I figured this out in the end by calling CWnd::BringWindowToTop() on both the control I wanted to drag files onto, and also the dialog that the control was on.

How to deal with MFC listcontrol window flashing

I wrote a MFC application program.I used some ListControl controls and some radio buttons in the dialog.I would like to realize real-time-update data with ListControl when clicked the single radiobutton triggering the corresponding events.
Firstly,when the dialog initialized,inserting data into the ListControl and showing the dialog.
Secondly,when I clicked the one radiobutton among these.The first step was to delete the all columns and all items in the ListControl.The second step was to insert my neccessary data into the ListControl.By the way,I used the same variable relative to the ListControl ID.
Notice:The data was changed by time!
Finally I found that the ListControl window appeared the fast flash and felt so bad.
So is there some good ways to solve this problem?And can you suggest some good or advanced advice to me?Thanks a lot!

MFC DoModal() Dialog is always on top across all applications

I have a dialog box (D1), which creates a new dialog box (D2) using DoModal().
What I've noticed is that, the dialog D2 is always on top. Even if I open a new application, the dialog D2 appears on top of it, while working with that application.
I want the dialog D2 to be on top always only in context of my application, and not across all the applications which I am using simultaneously. Could anyone tell me how I can solve this problem?
Thanks a lot. System Modal was set to true not for that window but for an underlying window. Setting it to false solved it !!

Programmatically and completely delete button from MFC toolbar

I have a document within MFC C++ application. I need to delete one the buttons from the particular CMFCToolbar within a code (not resources) completely, even preventing a user to restore the button via toolbar customization dialog. At this moment I use RemoveButton method of CMFCToolbar but it only makes the button invisible and it can be restored via toolbar customization dialog that is not an option for me at this time. I will be very glad if you suggest something that can help me there.
There are two internal lists in CMFCToolBar that are used to reset the Buttons upon customization.
They are named m_OrigButtons and m_OrigResetButtons.
You may need to derive your own class and delete the buttons with the specific IDs from there.
But better: Never to include such a button on the first time when the toolbar is created!

Access visual components text, buttons in a Internet Explorer_TridentDlgFrame dialog

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!