MFC, C++, View, View Resources - mfc

I'm going through THIS TUTORIAL On MFC
Lesson 2 states:
Clean Up UI Window
(Inside the VS Project Window) Click the menu item View >> Resource View
I click on View
A list of options drops down
The option Resource View does not appear on my list. I'll cut-and-paste a screen shot of that menu below.
Where do I click ?
Screen shot from Microsoft Visual Studio, Version 10.0.40219.1
Microsoft Net Framework Version 4.5.50938

It's under View - Other Windows - Resource View

Related

Coded UI Test winforms menu item identification wrong

I use the assertion function to identify controls. When I use the assertion function for the Coded UI Test (Ctrl + Shift + I) the menu items in my .NET application running on Windows 10 are always recogniced at the wrong position. I use Visual Studio 2017 Enterprise (version 15.5.7).
My cursor was at the "Öffnen" menu item but the MSAA thinks it is the "Speichern" menu item. It seems shifted for one menu entry.
For other application the control identification works fine. It seems a problem with this particular application.
What could possibly be wrong in using Coded UI Test Builder?
Update
I also tried to increase the MaxLevelsForItemContainer from the default value of 2 to 5 in the CodedUITestBuilder.exe.config without success.
The SearchConfiguration.NextSibling() method didn't work either.
It is probably an issue with the Spiechern button masking the Öffnen button -
atleast so far as the test builder sees it.
Try navigating to the Öffnen button through usage of the parent child navigator in the test builder (the button button 4 arrows around a blue box, next to Retry and Add Assertion), and then identify with the NextSibling() method. This would look like:
// Clicks Öffnen - Change NextSibling()to be whatever filial relation is required
var offnen = new WpfButton();
offnen = offnen.SearchProperties.Add(WpfButton.PropertyNames.Name, "Spiechern").NextSibling();
offnen.Click();
If that doesn't work set your tests up to use the identification of the Spiechern button, and then alter the portion that needs to click on the Öffnen button to click slightly above above the Spiechern button. That would look like:
// Clicks Öffnen - Change xOffset and yOffset to whatever is required to click Öffnen
var spiechern = new WpfButton();
spiechern= spiechern.SearchProperties.Add(WpfButton.PropertyNames.Name, "Spiechern");
Mouse.Click(spiechern, new Point(xOffset, yOffset));
I was able to do what I wanted by using the menu keyboard shortcuts and navigating through the menu and record this.
Possible solution in this case:
use keyboard shortcuts
After an Visual Studio 2017 Enterprise update from version 15.5.7 to 15.6.1 the menu item was recognized correctly. I'm not aware of any other change I did on my system but since the update it seems to work.
Solution:
Update Visual Studio 2017

how to show the print preview category?

Well I am working with visual studio 2015 on an mfc project.
I have enabled the office like ribbon in the project creation wizard.
I am inheriting from CView for my view class to get printing support as documentation suggests.
I have also overrided OnDraw too.
Now I want to get a print preview of the document with the print preview options on the ribbon.
I don't know where to start or how to act.
Any suggestions, propositions or examples ?
Thanks in advance.
You do not need to do it again for print preview window.
When you start a new "MFC application" for MDI and "Ribbon control", the application it self provides a print preview option.
Once you create a new application, Run the application.
The application runs and a windows opens.
Select the options as shown in below images.
You will get "print preview" option.
Search in the source code for "print view" to understand how it is implemented.

MFC customise - add new toolbar?

In an MFC app, when customising toolbars at runtime, is there an option for users to create their own new toolbars?
I have recently moved my app to the new MFC controls in VS2010. I was previously using the BCG version of this functionality, which pre-dates VS2008. (Microsoft bought the BCG stuff and wrapped it in to VS, as of VS2008). Anyway, I noticed that the Microsoft MFC version does not seem to allow the functionality for users to add their own toolbars under the toolbar customisation. Users can customise the icons on the toolbars, but the button to add their own new toolbars doesn't seem to be there.
Is there some way to enable this option in my code, so that users can create their own new toolbars?
It is also in the new MFC classes
When I create a new MFC program with the wizard in VS-2010 you can choose this feature on the page "User Interface Features". Select "Use a menu bar and toolbar. There are two further settings "User-defined toolbars and images" and "Personal menu behavior". You have to select the first.
Look into the created code...
HTH
PS: Also the new BCG classes are completely compatible with MFC 2010 and later.

Visual Studio MFC Toolbar Editor icon order won't update

I've been trying to create a custom toolbar in a MFC project in Visual Studio 2010. I've been following the Sketcher tutorial in Ivan Horton's Beginning Visual C++ 2010. The problem I'm running into is that the toolbar doesn't update to reflect the order and spacing of icons I have created.
I've created a small screenshot to demonstrate the problem:
In the background is the visual studio toolbar editor with my desired toolbar configuration. In the foreground is the actual app, which does not reflect the spacing or order of icons I've designed. It does reflect NEW icons being added, and the icons work fine, but I just can't seem to get them to re-order or appropriately space themselves. They just append to the end in whatever order I create them.
I've tried the rudimentary techniques of restarting both VS and windows, but to no avail.
Any tips on getting it to play nicely? Lacking that, is there somewhere to manually view or edit the code generated by the toolbar editor?
For starters, if you create an MFC SDI/MDI project in VS.NET 2005, there is no such issue. It happens in VS.NET 2008 and 2010.
In fact, your rearrangement of the standard toolbar does takes effect. It's just not showing you the default state. To restore the state: click the small arrow button at the end of toolbar -> Add or Remove Buttons -> Standard -> Reset Toolbar.
Though I'm not 100% sure why it happens like this(design like this or a bug), there is a way to work around it and it works:
Add following code to the end of CMainFrame::LoadFrame(...)
BOOL CMainFrame::LoadFrame(UINT nIDResource, DWORD dwDefaultStyle, CWnd* pParentWnd, CCreateContext* pContext)
{
...
// Explicitly restore toolbar state
m_wndToolBar.RestoreOriginalstate();
return TRUE;
}
I recommend you to contact Microsoft support engineers as there's little resource on the web.
The reason could be that the toolbar state is already loaded from the registry whenever your application starts. So the framework reads the toolbar state and adds the new buttons to the end. Is there a Workspace key in your Registry and did you try to delete it anytime you make changes to the toolbar? The key should be at a location like HKEY_CURRENT_USER\Software\MyCompany\MyApp\Workspace
The values for MyCompany and MyApp are usually set in InitInstance. Always calling RestoreOriginalState() would break the code to allow user modifications to the toolbar.

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.