Home > Software design >  c windows application edit the main window
c windows application edit the main window

Time:06-02

I'm trying to create a simple windows application in cpp. Opening Visual Studio 2019, I noticed that there is, in fact, a project like that, so I opened up a new one.enter image description here

This is the window I get when I run it. Completely normal, as expected from a brand new project.

But... I can't figure out how to edit the main window? When I go into the project rc directory, there's options to edit everything else. Add new dialogue boxes, add proper gui to them, edit the top bar with new options, etc. Does anyone know where is the gui for editing the main window?

CodePudding user response:

1.Right click on your project and Add resource -> Dialog.

IDD_DIALOG1 is created by default.

2.Modify the code in InitInstance() :

 HWND hWnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), GetDesktopWindow(), (DLGPROC)WndProc);

3.There is a IDD_DIALOG1 in the Resource View and it can be edited by double click.

  • Related