Not able to see the add variable wizard in mfc - c++

I'm using visual studio 2010 and i'M creating aN MFC dialog based application. Everything was working fine until recently when the add variable wizard stopped showing up when we right click on a control in main dialog and choose add variable.
I have 3 dialogs in the project. The add variable wizard shows up for the other dialogs. Only for the main dialog the wizard is not showing up, ie. nothing
is happening when we right click and choose add variable on say picture control embedded in main dialog.
I'm using 64 bit Windows 7.

The problem was ID mismatch(ID of main dialog) in the properties of dialog and the header of the corresponding class of the dialog. It is fixed and is working correctly now.

Related

How do I edit my Windows Desktop Application main dialog in VIsual Studio Commun2019?

I have to create a Win32 app for a college class.
I created the "Windows Desktop Application" in the create project section of the Visual Studio Community 2019 and it comes already with a standard dialog that can be tested on the go. Problem is: I cannot edit the main dialog. I can create another dialog and edit it but the main one is not accessible in the resource editor. What can I do? I can't find anything on google. Please help.
The main window of the default application created by the "Windows Desktop Application" project template in Visual Studio is not created with a dialog resource. It is created by registering a window class associated with a window procedure, as is standard when creating a desktop application.
You "edit" that window by changing the source code not with a visual editor.
>>I cannot edit the main dialog. I can create another dialog and edit it but the main one is not accessible in the resource editor.
Yes you can create it, but it has no class and can't be an object.You can try to create a Win32 desktop application, and then create a dialog. When you right-click the dialog box, you will find that you cannot add class.
If you want to use this dialog, you can only use this function DialogBoxW(hInstance, lpTemplate, hWndParent, lpDialogFunc) to create and show the dialog in your program. The third parameter is the Handle of parent window and it can be NULL. The forth parameter is the callback function.
So we test to call DialogBoxW in WinMain. You can check the picture below. We abandoned the traditional Win32 framework and made the custom window our main window. It work.
However, it should be noted that windows created in this form are modal, which is not applicable in many scenarios. What you say and what you want to do may be better done with MFC. Win32 does not encapsulate many interfaces like MFC for you to call.
I use Visual Studio 2013 Enterprise, but the procedures will be the same:
1 - On the Solution Explorer, click on the .RC file
2 - In the new window (Resource View), click in Dialog
3 - Double-click the dialog you want to edit...
That´s it...

How to insert more dialogs in MFC Dialog application?

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.

Windows Forms - ShowDialog with a parent - why doesn't clicking on the parent activate the dialog when main window is maximized

I'm seeing non-standard behavior (as compared to tools like Word and Visual Studio 2013) in my C++ Windows Forms application. We use Application::Run and then ShowDialog to show various modal dialogs. When one of the modal dialogs is up and I place another application window partially in front of the modal dialog, I can click on part of the modal dialog and it brings it back into the foreground as I expect.
However, if I instead click on part of the main window (shown with Application::Run) the modal dialog isn't brought to the foreground. This makes it hard to bring my application back so I can work on it. Ideas?
A simple MFC app created in VS2013 works as it should too. You can witness this with the About box which is shown with DoModal. I would have expected ShowDialog and DoModal to be equivalents. A simple C++/CLI or C# winforms application acts fine.
And this only happens in out application when our main window is maximized.
It turns out that is caused by our use of the Syncfusion UI libraries. They will be fixing the bug.

Quick Access Toolbar (QAT) doesn't shown in Ribbon MFC

I'm converting an existing application to use ribbon. I'm using visual studio 2012. I tried to add buttons through QAT properties editor in the ribbon designer. The QAT shown in the Test Ribbon mode correctly. But It's not shown when I debugging the application. The dropdown box button is there but not functional.
I've also tried to add buttons in code, but it makes no difference:
MFCRibbonQuickAccessToolBarDefaultState qatState;
qatState.AddCommand(ID_FILE_SAVE);
qatState.AddCommand(ID_EDIT_UNDO);
m_wndRibbonBar.SetQuickAccessDefaultState(qatState);
Any idea would be appreciated. The part of QAT in ribbon1.mfcribbon-ms is:
<QAT_ELEMENTS><ELEMENT_NAME>QAT</ELEMENT_NAME><QAT_TOP>TRUE</QAT_TOP><ITEMS><ITEM><ID><NAME>ID_FILE_NEW</NAME><VALUE>57600</VALUE></ID><VISIBLE>TRUE</VISIBLE></ITEM><ITEM><ID><NAME>ID_FILE_OPEN</NAME><VALUE>57601</VALUE></ID><VISIBLE>TRUE</VISIBLE></ITEM></ITEMS></QAT_ELEMENTS>
I solved it. In the CAppnameApp::InitInstance() function in the Appname.cpp, call InitContextMenuManager() function. This initialize the CContextMenuManager object which manage shortcut menus. This object is introduced in VC2008. Also other functions like InitShellManager(); InitKeyboardManager(); InitTooltipManager();need to be called at the same place.

regarding mfc dialog bar

I am new to MFC and VC++ programming. I have two questions:
How do I make a resizable dialog bar?
How do I give background color for a dockable dialog bar?
Thanks!
So i assume we are working in visual studios 2008 or similar and i assume you have an MFC SDI or MDI application that you are working on.
Open the resource viewer (View->resource view).
Expand the project that you would like to place the dialog in.
Expand to the dialog folder.
Right click this folder and click add resource.
Expand and add a new dialog bar.
Give it any properties you like using the properties window.
To (display/ give context) your dialog bar, instantiate and get the
handle of the dialog. Like
GetDlgItem(ID)-> ShowWindow(SW_SHOW);//show
Where ID is the id of the dialog. You can obtain this by going into the resource viewer, right click on the dialog, properties, and the ID is given in there.