|
Forum
|
|
|
Using Dialog Resources, How do I reference a dialog that
|
|
| gavinm |
|
New Member

Group: Members
Posts: 1
Member No.: 10116
Joined: 15-July 08

|
Hi
I have created a dialog box to display info. How do I reference the resource from my code?
I have modified the Win32 skeleton program, and am tailoring it as a learning excersise to perform simple tasks.
My objective is to open a .txt file(a csv file of my bank statement), read and parse the file and display the sorted contents of the file into a dialog box. The dialog box has a single exit button.
I am looking for the syntax to reference the dlgbox. Contents of my .rc file.... define IDD_DLG1001 1001 #define IDC_BTNEXIT 1002
IDD_DLG1001 DIALOGEX 0,0,221,131 CAPTION "Account Details" FONT 8,"MS Sans Serif" STYLE 0x10cc0000 EXSTYLE 0x00000000 BEGIN CONTROL "Exit","IDC_BUTTON1002","Button",0x50010000,96,96,81,21,0x00000000 END ....
Regards Gavin (newbie)
|
| |
|
|
|
| shoorick |
|

Extremely Active Member
     
Group: Admins
Posts: 2303
Member No.: 160
Joined: 22-June 04

|
there are two ways to reference: by string name and by integer ID.
calls are similar: the system distinguish ID from string by high word of dword - if it is zero - then it is ID, if not - then string (windows addressing lets usage of such recognizing)
#define IDC_BTNEXIT 1002 - means symbolic constant IDC_BTNEXIT (clear to us as "ID for Button <Exit>") has 1002 value
CONTROL "Exit",IDC_BTNEXIT,"Button",0x50010000,96,96,81,21,0x0000000 - means "control of <button> class with <Exit> caption has ID IDC_BTNEXIT (=1002) - note: IDC_BTNEXIT has no quotes here, if yes - it will be interpreted as string
now you can reference to the button "Exit" from you code as: A. cmp ax,IDC_BTNEXIT or B. cmp ax,1002
note: to be able to use the first variant you must export all "#define ..." into "... equ ..." and include it into the assembly source. (assembler do not understand "#define" statement)
usage of string names has sense if you are writing, say, a dll with dialogs or controls, so, it is better to use string identificators instead numeric to use in documentation etc.
|
| |
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
|
|
|