WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Sponsors
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
Hard Drive Recovery
Wiring your own LAN
Personal menu
Welcome Guest
User:
Pass:
Register!
Resend Validation Email
 
Forum
 

Using Dialog Resources, How do I reference a dialog that

gavinm
Quote Post


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)
PMEmail Poster
Top
shoorick
Quote Post


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.
PMEmail PosterUsers Website
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian
Google