Joshua
Joshua

Reputation: 1208

How to use Visual Studio Dialog Editor with just C++ Win32 API (no MFC or WinForms)

I'm quite new to GUI programming in C++ and I'm trying to use the Visual Studio Dialog Editor.

I've already created a dialog and assigned it a Dialog Procedure but I don't know to get the hwnd handles for any controls I add from the Toolbox.

How do I interact with the Dialog Editor controls without using MFC or WinForms?

In this specific instance, I want to create and populate a Listbox and buttons.

Upvotes: 2

Views: 3409

Answers (1)

Roman Ryltsov
Roman Ryltsov

Reputation: 69724

The dialog template has controls defined with dialog identifiers. When the real dialog is instantiated from template, you can use GetDlgItem API to get a HWND for your control, given its identifier.

See use of GetDlgItem under item 4 here: The Modal Dialog and Windows Common Controls 3 when the code gets a scrollbar handle.

Upvotes: 2

Related Questions