tags:

views:

520

answers:

4
+1  A: 

You do not have to register a dialog box.

Dialog boxes are predefined so (as you noted) there is no reference to a window class when you create a dialog. If you want more control of a dialog (like you get when you create your own window class) you would subclass the dialog which is a method by which you replace the dialogs window procedure with your own. When your procedure is called you modify the behavior of the dialog window; you then might or might not call the original window procedure depending upon what you're trying to do.

jr
Dialog boxes have a predefined window class (#32770), so you don't have to register anything. BTW, the # means MAKEINTRESOURCE.
Roger Lipscombe
A: 

This is only tangentially related to the question, but if you are new to Windows programming, why are you using Win32? Unless there's a lot of low-end code (which should be separate to the GUI anyway), it probably makes more sense to use .NET, which should cause far less head injury as well.

Sören Kuklau
A: 

@Soeren Kuklau

[...] but if you are new to Windows programming, why are you using Win32?

It is mostly due to the fact that my little venture into windows programming (I usually write embedded C code) started with a Windows simulator project for our Embedded GUI framework. The example project used the Win32 API. I started to play around with it and ended up getting interesting in some of the details.

cschol
+1  A: 

It's been a while since I've done this, but IIRC, the first case is for creating a dialog dynamically, from an in-memory template. The second example is for the far more common case of creating a dialog using a resource. The dynamic dialog stuff in Win32 was fairly complex, but it allowed you to create a true data-driven interface, and avoid issues with bundling resources with DLLs.

As for why use Win32 - if you need a windows app and you don't want to depend on MFC or the .NET runtime, then that's what you use.

Brian Stewart