Show Message Bar in ribbon mfc - c++

Probabbly i am not sure what to search for ... But the idea is to display a message bar bellow ribbon control. When user try to edit a read only file. I don't want user to click on OK to remove error message. Thats why i can't use MessageBox.
Status bar doesn't seem right place to display error messages.
Which control i should start exploring.
MSOffice normally displays such message when user opens files in protected view .
I don't want you to do research for me, I just want the right direction i will do the rest.
Thanks

You can easily use CMFCCaptionBar for such an attempt. When you create a ribbon bar SDI application you get sample code for free.
Also it is possible to hide and Show such a bar on the fly with ShowWindow. Also this code is generated by the wizard.

Related

Adobe DISPATCH_METHOD for disabling navigation bar, bookmark and right click etc (MFC)

I am very new to activeX control and I need to embed adobe activex control in my MFC dialog.
I use the example code in https://www.codeproject.com/Articles/9537/Adobe-ActiveX-Control-with-MFC to implement an Adobe ActiveX control, it works and display the pdf file successfully.
I need the pdf to be displayed without toolbar, navigation bar, bookmark and right click, but the sample code only contains a method like following:
It works for disabling toolbar. But there is no method for navigation bar etc.
I searched online for InvokeHelper(0x3, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, On); and realize that 0x3 is the DISPATCH ID and it is invoking the Adobe API by this ID.
Therefore, I guess there must be other method in Adobe for navigation bar and bookmark etc, but I cannot find the corresponding document about the method DISPATCH ID.
Anyone knows that please ?
I even cannot find any documents about the setShowToolBar method DISPATCH ID.
By reading Interapplication Communication API reference from Adobe, I find out how to close the bookmark automaticlly.
I called SetPageMode(L"none"), it works for closing bookmark.
But I haven't figured out how to close the navigation bar and status bar.

How do I navigate from a dialog button to the code behind?

Cant believe I cant figure out how to do this.
If im looking at a created dialog in the dev studio and it has an ok button, how do I quickly get to the code for when the OK button is clicked?
At the moment I have to copy the resource ID for the dialog e.g. 'IDD_MYDIALOG'
search for that in the source files, open the source file, then start looking for an On_Ok() style function then do a search on that function then open it.
Thanks
ps Id also like to know how to do the same for menu selections.

C++ CListControl - check if selected

I've got a ListControl box and I want to enable a textbox if the user clicks on a button there.
I've allready tried to update the dialog via an "OnLeftButtonUp" function which works quite well if I click outside the ListControl but when I click INSIDE the box nothing happens...
Any ideas why?
Cheers

Accessing a right click context menu from an external application

After performing some Google-fu and searching Stack Overflow I've been unable to find a way to access the right click menu of an item and read data or select an item from it. I've looked up methods for SendMessage and PostMessage
What I've done so far:
This is an example of post here that would have been exactly what I want if it didn't use Qt and would work on an external application. Everything I've been able to find is about creating a right click menu when I just want to view an external application's right click menu.
I've tried getting the handle of the context menu using Spy++ but the menu just disappears as soon as I select the "Find Window" option in Spy++ (which is to be expected).
The only way I could think of doing this is using mouse_event to display the box but then I don't know where to go from there. I feel like this would also be very inefficient.
I'm working on some legacy code so I don't have a lot of choice in what I can use, if it's possible I'd like to not use libraries that aren't included in Visual Studio 2008.
What I'm trying to do:
I'm looking for a way to access the right click context menu in an external application and read the data in it and then select an item. I feel like this should be really simple but my research skills are subpar. If anyone can point me in the right direction I would really appreciate it.
Thank you for reading!
The only way you can get hold of a context menu is to make the application display it. It doesn't exist otherwise. (The other question you give as an example is regarding the Windows Shell menu which is designed to be useable)
A window gets sent WM_CONTEXTMENU when the user right clicks, so you could use SendMessage() to invoke the menu, or failing that just send a right click.
After a bit of googling, I think context menus have a classname of #32768, so you could use FindWindowEx to find a child window handle with the matching classname.
Once you have the window handle, you can use the MN_GETHMENU message to get hold of the menu handle.

MFC SDI Text Editor

I am creating an MFC SDI explorer style application (it has a splitter bar and the right-hand pane is the text-edit area, left-hand pane is the tree-view)
My right-hand pane is a CRichEditView.
I want to be able to detect when a user has edited the text so that a flag is set to show that a change has been made but has not been saved. I have tried several ways of doing this e.g. catching WM_KEYDOWN in PreTranslateMessage, but this catches everything and prevents the keypresses from editing the view. I have also tried adding ON_WM_KEYDOWN() to the message map in the MyView.cpp. Again, this seems to prevent the keystrokes from having any affect on the text in the view. I want to allow the user to edit the text in the view, but the application to know that this has been done.
Please help - I have looked for hours for ways to do this.
Many thanks
Adding ON_WM_KEYDOWN() to the message map is probably the correct approach. You must make sure that your implementation of the OnKeyDown() method calls the base class method so that the message gets passed on as appropriate.