News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

what is the diffence between these functions...

Started by RHL, May 09, 2012, 05:54:06 AM

Previous topic - Next topic

RHL

Hello alll :)
fine, I want to know you opinion about my question guys :)
what is the diference between DialogBoxParam, InitCommonControlsEx, CreateDialogParam, DialogBoxIndirectParam, CreateDialog functions :S

I see thus in C++, Asm codes that it use to create dialogs or to load resources :P
but why there are much!?
in your opinion, which is the better?

because always I have problems with WINPROC procedures lol and want to know which of these functions you would use, for example, in their projects serious which function do you use?
any words thanks for you opinion :)

MichaelW

DialogBox is actually a macro, so in MASM code you should use the DialogBoxParam function.

DialogBoxParam creates a modal dialog from a dialog box template resource.

DialogBoxIndirectParam creates a modal dialog from a dialog box template in memory.

CreateDialog is actually a macro, so in MASM code you should use the CreateDialogParam function.

CreateDialogParam creates a modeless dialog from a dialog box template resource.

CreateDialogIndirectParam creates a modeless dialog from a dialog box template in memory.

The choices are basically a modal dialog or a modeless dialog, a template resource or a template in memory.

Modal dialogs are generally easier to code, primarily because the system provides the message loop, but a side effect of this for dialogs that have an owner window is that the owner window is disabled until the dialog is closed.

For a modeless dialog you must provide a message loop, as you would for a normal application window. For a modeless dialog with an owner window the user is free to switch the input focus between the dialog and the owner window, so the dialog and the owner window can be used independently, but the system will automatically close the dialog when the owner window is closed.

For simple dialogs I prefer to use a template in memory, and MASM32 includes a set of macros (see dialogs.inc) that make this very easy. For complex dialogs a dialog box template resource created by a dialog editor would probably be a better choice.
eschew obfuscation

dedndave

yah - it is messy to code one of the "Indirect" variations, directly
but - it is a good experience to do it once - just so you know what is going on in the background

the "Param" extension to a function name means you can pass an LPARAM to the dialog when it's created

RHL

thanks you to guys, it cleared.  I will practice and seek codes with to these functions  :toothy