0
votes

Visual Studio Resources Editor undoubtedly contains valuable set of tools that help when creating UI for MFC applications, especially various dialogue boxes and graphic elements.

I have reasons to stay with non-managed C++, which mean staying without the usage of Windows Forms. I therefore got an idea, if it is possible to use resources created with VS2012 Resources Editor in non-managed C++ while creating non-MFC applications.

  • How to refer to the GUI elements from within my non-managed C++ code?
  • can I completely abandon MFC structure and use my own C++ design?
  • Would you know about any good tutorial that covers this? I searched on the net and tried YouTube too, but I did not find suitable example covering this question.

I use:

  • Visual Studio 2012 Ultimate
  • Windows 7 x64
  • non-managed C++

Thank you.

1
The resource editor doesn't have anything to do with MFC, it works for any Windows gui program. Don't look for a tutorial, you need to read a book. Start with Petzold's "Programming Windows".Hans Passant
@HansPassant: +1, hi and thanks for your response. If I understand correctly, the way .rc files are created is perfectly compatible with WinAPI, and I can apply standard WinAPI calls to display those UI components. I have already read Petzold, but I will open it again, to find answers on my question.Bunkai.Satori

1 Answers

2
votes

MFC is essentially a wrapper around WinAPI and as such resource files can be used completely without MFC. At design/compile time:

  1. Drag and drop your resources to create the .rc file
  2. Include the generated header file - #include "resource.h"

At runtime:

  1. In your code, make sure to call InitCommonControlsEx
  2. Load the resources with WinAPI calls such as DialogBox, CreateDialog, etc.