Controls on main window using Visual C++ designer? - c++

Is is possible to draw controls using Visual C++ designer on the main window, in the same way you can design dialogs? I'd preferably like to be able to design the main window controls this way without using MFC, rather than creating them on WM_CREATE.
EDIT: I don't want a dialog-based app, just to be able to design the main window graphically similar to what can be done using Windows Forms Designer in .NET?

Your options are:
Use MFC and create a main window that has a dialog view (based on the CFormView class).
Use WinForms/.NET
Use Qt.
If you're starting a new project and you want to stick with C++, then I highly recommend Qt. Not only is it an excellent framework, but it's cross-platform so your app could be built on Linux and the Mac.
http://www.qtsoftware.com/products/
A Visual C++ plugin is available and you can design your main window visually using a tool called Qt Designer.

I'm not sure if I understand what you want your app to look like. If you want your application to be a dialog, then make it a dialog app.
Just create a new MFC Application, and set it to "Dialog based". Now your application will start at that dialog.
If you want to use a native win32 app, just create the dialog in your InitInstance, using CreateDialog (instead of CreateWindow).
In both cases, you use the resource editor to create the dialog.

Related

ribbon control in mfc dialog based application

I am using visual studio 2010 professional edition. I am working on MFC dialog based application.
I have created the ribbon resource and try to load the same using the following:-
m_wndRibbonBar.Create(this);
m_wndRibbonBar.LoadFromResource(IDR_RIBBON);
Where CMFCRibbonBar m_wndRibbonBar is declared in the header file as well.
But I can't create the same in dialog based application, it will work in SDI or MDI application.
I would like to create the ribbon control in a dialog based application.
Is there any possibility to do so, if not, what are the alternatives for the same?
As answered elsewhere on the internet, for example:
ribbon control in mfc dialog based application
To quote:
According to the MSDN documentation:
Ribbons cannot be created in dialog-based applications. For more information, see see Application Type, MFC Application Wizard.
Possible workarounds:
To use a Ribbon, use an SDI application with a View derived from CFormView.
Use a toolbar instead.

How can I implement a MFC resource within a Win32 window?

I have two projects, an old project using the Win32 API that has an old toolbar using Win32 graphics and another one using MFC code with better graphics (I am creating a ribbon toolbar similar to the one that Microsoft Office uses). The MFC classes I use inherit from CDialogEx and CWinApp.
What I am trying to do is to place the ribbon toolbar in my Win32 window and replace the old one. I am already referencing the MFC project using it as a static library and can call the classes from my Win32 project but I can't get to show the new toolbar yet.
What do I need to do in order to achieve this?
It might be much easier to create the freamework with the MFC and move the old code into the new framework.
It is possible to create a MFC project without Doc/View architecture.
The MFC Ribbons will and can only live inside a CMFCFrameWnd that is part of a CWinAppEx... extracting just the ribbon code into a plain Win32 application should fail.
But there is also a Win32 Ribbon Framework. It might be much easier to implement this into your old Win32 project.
How to implement this is described here.
In Codeproject you find a sample how to use it.

How to use MFC ListCtrl in SDI

I am really a beginner with MFC. I just want a few guidelines on how to use a ListCtrl in an SDI application. For example, getting input from the user and displaying it in the listctrl when a button is clicked. Please guide me.
In SDI application I would use CListView-derived class for main view. This class has been designed to be used in SDI/MDI apps and supports standard MFC document-view architecture. The CListView class internally uses CListCtrl, but it does automatic resizing and other handy things, you can also get direct access to embedded list ctrl by calling CListView::GetListCtrl() method that returns CListCtrl*.

In MSVC there are such things as MFC custom controls (design time), is there a such thing as a win32 custom control?

In microsoft visual c++ (visual studio) one can create design time controls that you drag and drop on to your dialogs using MFC.
For example http://www.codeproject.com/Articles/521/Creating-Custom-Controls
My question is: can one develop win32 custom controls that you can drag and drop onto your dialog at design time, without using MFC? Or with win32 programming are you stuck with the controls that win32 offers you (i.e. edit, listbox, checkbox, etc.).
Does the visual studio c++ ide only allow you to create mfc custom controls at design time, and with win32 you must create custom controls at run time?
It is true you are more limited as for having the option to select a control from the Toolbox, which is easy with MFC. However, you can create or use custom controls for a Win32 project, and yet, such controls will be fancy and professionally looking project that doesn’t support MFC.
These custom controls will be either static libraries, DLLs or just c++ classes.
Here is an example.

Common Controls Plugins for MFC like in c#?

I'm working with MFC VC++ Application. I would like to use simple UI like in c# NumericUpdown & openFile Dialog & SavefileDialog etc in my application. I would like to know is there any wrapper or plugin for MFC to do this process? Because it is too messy to add a simple control using MFC when comparing to C# .Net! Is there library or plugin to reduce this task? Preferably a free one.
Maybe you just don't know how to do it? In an MFC app controls are easily added by dragging them from a toolbar onto a dialog template. That is the "Visual" part of Visual C++.
And the open and save dialog are available using MFC class CFileDialog.