C++ style menu bar in VB.NET? - c++

Ive been looking a long time for this, but can't seem to find it. When I add a menu strip in vb .net, it looks like this:
http://img19.imageshack.us/img19/4341/menu1sbo.jpg http://img19.imageshack.us/img19/4341/menu1sbo.jpg
and I want it to look like the WinRar, Calculator, Notepad etc menus like this:
http://img8.imageshack.us/img8/307/menu1a.jpg http://img8.imageshack.us/img8/307/menu1a.jpg
From what I gathered, in vb 6 you could create a mainmenu and do it this way, but in vb .net it seems like all there is is ugly menustrip.
Thanks

You may have to get dirty and create a CustomRenderer(ToolStripProfessionalRenderer) to apply to the ToolStripManager
Without rehashing to much, this doc looks like a nice overview or you can always opt for the Microsoft tutorial
menustrip is derived from toolstrip

You may need to enable XP theme support in your project settings. To do this, go to My Project in your Solution Explorer, and make sure "Enable XP Visual Styles" is checked under the Windows application framework properties group down near the bottom of the Application tab.
If this doesn't work, you might need to create an application manifest as described in this MSDN article.

This question is quite old but for anyone else interested, you can find this type of menu in the .NET framework components. Just right click the Toolbox -> Choose items -> .NET Framework Components and filter for MainMenu. Works exactly like any other menu strip from what I've seen so far.

Related

VSIX Project - Properties tool window extension

There might be something wrong with the way I search for things but here is my problem. I'm looking for a way to implement a custom editing tool within the properties tool window in the Visual Studio editor. I've been looking through several documentation references, and they all lead to the use of different assemblies, but I can't get anything to work the way that I want.
First of all, I tried using the UITypeEditor class, with the step-by-step tuto I found here : https://learn.microsoft.com/fr-fr/dotnet/api/system.drawing.design.uitypeeditor?view=net-5.0
The problem I faced was that it only seemed to be working with Winforms projects, and I'm trying to use this with a WPF project.
Afterwards, I tried following this tutorial, in order to create a project template : https://learn.microsoft.com/en-us/visualstudio/extensibility/creating-a-basic-project-system-part-1?view=vs-2019
This has led me to think that the methods used in the tutorial might have been either deprecated or improved with the used of AsyncPackages instead of ProjectPackages, and the appearance of the Microsoft.VisualStudio.Shell.Flavor assembly that seem to render useless the ProjectNode class (it doesn't even show up anymore, the method has been replaced with a void).
The last bit I tried exploring was the use of the ProjectSystem, as documented here : https://github.com/microsoft/VSProjectSystem
It was actually worse because I couldn't get it to work like I wanted, the project type I was creating could not register C# files and I wasn't able to add new classes (I might need to dig a bit deeper here but I don't know where to look).
So basically, I'm looking for help to extend the properties tool window, through an editor within the window, or a modal window opened by clicking on an ellipsis button in the properties window.
Thank you for reading this, if you have any info, I'm very interested.
I've actually found a thread leading to what I was trying to do here. This tutorial leads to a way to implement a customized editor, either inline, extended or in another dialog window. This was the thing I needed, and with a few tweaks I managed doing what I wanted.

Table/Grid using MFC

I just started developing an MFC application for the first time and I'm hoping to get more familiar with the whole "controls" concept. I am using the dialog editor in visual studio and so far I was not able to find functionality to add a simple table/grid. It seems quite basic to me, but I can't even find reliable information on how to do it on the internet.
I am looking for something similar to Qt's QTableWidget, something that I can later program with variable amount of rows and columns tailored to my application's use cases.
Do you have any ideas how to do it?
I use CGridCtrl which is very powerful and does a lot of the legwork for you.
Sounds like you're after a List View Control, which is wrapped by MFC's CListCtrl class. The dialog editor will enable you to add one and set its properties.

Windows MFC macros

I'm trying to learn the MFC to code for Windows and I've come across things like the ID_FILE_EDIT macros that are defined as being unicode values I think. I understand, I think, that the macros specify the item in the menu pulldowns. Question is, how do I define my own and where do I put them. I'm trying to get custom menus and custom menu buttons to stem from the MFC. Like I want under file 'new, open existing doc and stuff like that'. I've got VS2013 pro and all the headers I could ever want. Second question is where do I start with the MFC. Should I start by practicing making windows then pulldowns and then... something else? I know where the documentation is at and I understand where the class references are. Really just confused on using it to make my own stuff.
ID_FILE_EDIT (and other defines, like ID_FILE_NEW, ID_FILE_OPEN, etc.) are macros to specify a name for an unique resource identifier that is used to identify a menu command and/or toolbar item. They are typically defined in a header file named resource.h.
Microsoft has released a numbering and naming convention as a Technical Note (TN), because the names and values ​​represented by these macros must follow a certain pattern: http://msdn.microsoft.com/en-us/library/t2zechd4.aspx
Under normal circumstances you can use Visual-Studio's built-in resource editor to create dialogues, menus, buttons, and all the other UI stuff. These editors also assign automatically unique ID's for any resource and generate the macros.
Your second question can not be answered easily. MFC applications are a wide field, ranging from simple, dialogue-based programs to sophisticated Model-View-Controller-based applications. If you just want to play around with MFC to familiarize yourself with the basic concepts of this framework, I recommend to start with a dialogue-based app.
Regards,
Stephan
In VC++ 6.0, Insert menu - Resource - Menu. Is how you add/edit a menu.
Where is the formatting bar gone on answers.
To learn MFC basics, manually build up the Scribble example application (http://msdn.microsoft.com/en-us/library/92y4h944%28v=vs.90%29.aspx) with which whole generations of MFC programmers made their first contacts with MFC. Don't just read it, start with an empty application and gradually add the stuff as in the tutorials. It'll show you a lot. If you don't know the win32 api yet though, you may want to start with reading the Petzold from front to back. Good luck, remember that these are libaries and API's from a time when it wasn't considered unreasonable to spend 3 months full time to learn something.

WinCE 6.0: Customizing Control Panel (cplmain)

i work on a Windows CE 6.0 Image and added a Audio driver to my Solution (my solution is based on a image without audio). Sound works fine but i dont know how i can add the standard Windows CE 6.0 Sound Settings dialog to the control panel.
MSDN says the following:
"The Windows CE Control Panel allows users to set a variety of system-wide properties, such as mouse sensitivity, network setup, and the desktop color scheme. You can select specific functionality to include in your Control Panel by specifying them in your Cesysgen.bat file."
Can anyone explain how this works exactly via Cesysgen.bat? In my project i cant find any entry for cplmain in my Cesysgen.bat.
Could it be that those standard Applets are integrated into the control panel automatically? (maybe with "getProcAddress()" when a specific driver is loaded?) - This idea comes from "cplmain.def", there is written:
EXPORTS
CPlApplet
; These functions are exported for componentization
; We use GetProcAddress on ourselves to dynamically discover
; what components we have
I found a quite good explanation from Andrew Pearson here:
http://www.itlisting.org/4-windows-ce-embedded/a57eef4103191b7a.aspx
but i tried a few different things an nothing worked! So this confuses me even more. The only statement there i really understand now is:
The control panel, unfortunately, is about the single most confusing thing
to build in the whole tree.
Yes it is! Would be nice if anyone had an idea.
Kind regards,
Martin
I've created custom control panel applets before, and to be honest, trying to modify the existing applet is about the worst thing you can try. Generally what I do is just create a whole new applet, which is really just a DLL renamed to have a .cpl extension and that exports the CPlApplet entry point.
There's an example in MSDN that shows the expected values the OS will pass in to get your icon, tell you to start and those types of things.
Basically just build your own applet as a completely separate project, then include it in the MODULES section of your BIB file. Don't even mess with the existing train wreck of control panel code.

How to auto-generate settings/options dialog box?

Using Visual Studio 2010 C++ with MFC. The number of configurable settings in my application is slowly creeping up. I managed to design a settings class where adding a single line will add a setting to the program and support reading/writing that setting to my ini file. However, I still need to go into my gui editor and edit the options dialog box, moving text boxes around, aligning labels etc. which is kind of a pain.
How would I autogenerate my options dialog box such that I could give it a data structure and it could generate the option interface for me? It's okay if it's something like a list box. I'm thinking something like the the Visual Studio properties dialog box which has the look of something that's programmatically generated:
I'm just trying to get a conceptual overview of what controls would be best and how to piece it together. Of course if there is a link to a web page discussing this that would be great.
You want the CMFCPropertyGridCtrl class. It was introduced in one of the MFC updates, but I'm not sure whether or not they come pre-installed with Visual Studio 2010; you may need to install something extra.