I saw this sentence in a program in asm,
I do not undestand the meeming of the number 100 in

invoke DialogBoxParam, hInstance,100, 0, ADDR DlgProc, 0
Posted on 2002-12-12 16:01:12 by Fernand
:\ From api reference:

int DialogBoxParam(

HINSTANCE hInstance, // handle to application instance
LPCTSTR lpTemplateName, // identifies dialog box template
HWND hWndParent, // handle to owner window
DLGPROC lpDialogFunc, // pointer to dialog box procedure
LPARAM dwInitParam // initialization value



Identifies an instance of the module whose executable file contains the dialog box template.


Identifies the dialog box template. This parameter is either the pointer to a null-terminated character string that specifies the name of the dialog box template or an integer value that specifies the resource identifier of the dialog box template. If the parameter specifies a resource identifier, its high-order word must be zero and its low-order word must contain the identifier. You can use the MAKEINTRESOURCE macro to create this value.

Get it now?
Posted on 2002-12-12 16:18:12 by wicr0s0ft
wicr0s0ft, dont be to harsh on the guy? dont forget that we are here
to help others. Maybe he's new to assembly and dont have the win32 api
reference available. ( :) )

Fernand, since I doubt that you have the Win32Api reference, I suggest
that you download it. It's something every programmer should have available
at all times. You can download it from here: http://spiff.tripnet.se/~iczelion/download.html

You'll find almost every api explained inside the help file. You can also visit:
http://msdn.microsoft.com/library/default.asp wich contains every api known
to windows. Plus i suggest you visit the "Asm: Web-link collection" linked below
my signature. Happy trails... ( ;) )
Posted on 2002-12-12 16:33:10 by natas
Usually that number would be a 'define'.
Most of the times you design the dialog-box in the resource-editor of MS-visual C++ ide, or some other resource editor,
and copy the resource script to your masm-project.
The resource compiler will generate a list of constants which identifies each element in the dialog-box, like the controls in it,
and the dialog-box.
The constants use to be stored in a file by the resource-editor, commonly 'resource.h'

Looking like (example)

#define IDD_MAINDLG 101
#define IDR_MENU1 102
#define IDC_EDIT 3000
#define IDC_BUTTON 3001
#define IDC_EXIT 3002
#define IDM_GETTEXT 32000
#define IDM_CLEAR 32001
#define IDM_EXIT 32002
#define IDM_OPEN 32003

Above IDD_MAINDLG would mean the dialogbox itself, and others menus, edit-boxes, and buttons in the resource script.

So in the case of your 'invoke' you will more often see (if we say you had the above constants identifying the dialog-box controls and stuff)

invoke DialogBoxParam, hInstance, IDD_MAINDLG , 0, ADDR DlgProc, 0

Like you would most of the time see an define instead of a hardcoded number.
The IDD_MAINDLG (101 in this case) just is to identify which dialog-box script to create into a window.
Hope this helped ...(sorry for my bad english :-S )

Posted on 2002-12-12 18:45:25 by david
I agree 100% with Natas' recommendations. Meanwhile, it does not answer your immediate question.

A resource file is often used to include specific data related to your program, such as the menu items, accelerator keys, bitmap drawings, dialog box details, etc. Each of these items can be given a name and/or an identification number which you can use somewhat like a handle number when you want to refer to the item.

In your example, the author had given the number 100 as the ID of the data in his resource file pertaining to the subject dialog box.

If you don't have one already, a resource compiler (rc.exe) is available on the MASM32 site.

Have fun

Posted on 2002-12-12 18:57:23 by Raymond

I agree 100% with Natas' recommendations. Meanwhile, it does not answer your immediate question.

Raymond, I know that I didnt actually answer his question directly. However,
sometimes I think that people learn alot more by trying to read from the source.
Rather then reading a small 'page' ripped from the 'book'. Especially when it comes
to things wich are related to the basic windows things like api etc.
Posted on 2002-12-12 19:05:32 by natas
That is the way I have been learning myself, by reading and trying. I had even written my own compiler for the TRS-80 by coding the instructions manually.

However, one occasionally needs a simple advice to get going. In my case, I knew nothing about resource files at first. When I asked and got a more direct answer, the world 'opened up' a lot faster.

The suggested rc.exe package may not be the best available but it does contain enough info to get the person started. And the only reason I wanted to add to your comments was to direct the person to something more specific relating to dialog boxes and resource files.

Otherwise, let's just make a list of all the info available, post it, and just refer everybody to that list when they ask questions.

Let's still have fun

Posted on 2002-12-12 19:25:03 by Raymond
Raymond, to me learning like that is the 'fun' part about it. ( :grin: )
Even so I know that some people dont like that. And usually I do
give out some direct pointers in form of information or source code.

BTW: you where talking about refering to information? thats also
why I recommend everyone to look at the thread linked below
my signature. (The Asm:Web-link Collection) ( ;) )

Posted on 2002-12-12 19:28:06 by natas
HI ...Thanks for all your help ...I get it now !

Posted on 2002-12-12 19:32:34 by Fernand

The 100 is no more than a numerical identifier that is set in the resource script file. You can use names but they tend to be unreliable and numbers are recommended for reliability.

What happens is that when the resource script (.RC) is compiled and linked into the exe file, the DialogBoxParam function can find the information for the dialog box from the resource section by its ID number.

If you are using a resource editor that creates equates so that names are substituted for numbers, you can use the equates but it is a bit more typing and I persoanlly prefer to use the numbers as they are more direct to the script that has the resource data.


Posted on 2002-12-12 21:50:39 by hutch--
Hello natas,

I am not being harsh. I told him everything he needed to know about the API asked. If he didn't now about resources, or even not much about assembly, he gained a few "hints" in my asnwer too... :-d

And else, I didn't know that API even after a while programming in win32asm, so I posted a thread on it too... ;) ... I was just direct that the question he asked is plained asnwered in the API reference, and if he didn't knew it, he should say so.

Right, Fernand? :)

Regards to all.

Posted on 2002-12-13 14:25:29 by wicr0s0ft