\masm32\examples\exampl09\tables
Any Explaination would be appreciate.
I get the main point but puzzled by some sentences and usage.
1.
checkarray MACRO cnt1,cnt2,spc,lft,top:REQ
LOCAL idnum,hstep,vstep,lspc,stcnt,var
idnum = 500
stcnt = 400
hstep = 0
vstep = 0
REPEAT cnt1
DlgStatic 0,SS_RIGHT,3,top+vstep,15,8,stcnt
stcnt = stcnt + 1
REPEAT cnt2
DlgCheck 0,0,lft + hstep,top + vstep,8,8,idnum
idnum = idnum + 1
hstep = hstep + spc
ENDM
vstep = vstep + spc
hstep = 0
ENDM
ENDM
2.
mov hInstance, FUNC(GetModuleHandle,NULL) ---- FUNC() ?
3.
main proc ---- What's the habit/usage to create window? Why not use .rc file?
Dialog "Create Character Table", \ ; caption
"MS Sans Serif",10, \ ; font,pointsize
WS_OVERLAPPED or \ ; styles for
WS_SYSMENU or DS_CENTER, \ ; dialog window
256 + 16 + 8, \ ; number of controls
50,50,203,240, \ ; x y co-ordinates
32768 ; memory buffer size
DlgButton "Numbers", WS_TABSTOP, 21,185,50,13,100
4.
CallModalDialog hInstance,0,DlgProc,NULL ---- CallModalDialog? Where is the defination?
free pMem
5.
mov str1, ustr$(ccntr) ---- ustr$(ccntr) ?
fn SetWindowText,FUNC(GetDlgItem,hWin,nrange),str1 ---- fn?
mov str1,cat$(str1,"Ascii ",str$(ctrl)," Hex ",right$(hex$(ctrl),2)," Character ",str2)
Any Explaination would be appreciate.
I get the main point but puzzled by some sentences and usage.
1.
checkarray MACRO cnt1,cnt2,spc,lft,top:REQ
LOCAL idnum,hstep,vstep,lspc,stcnt,var
idnum = 500
stcnt = 400
hstep = 0
vstep = 0
REPEAT cnt1
DlgStatic 0,SS_RIGHT,3,top+vstep,15,8,stcnt
stcnt = stcnt + 1
REPEAT cnt2
DlgCheck 0,0,lft + hstep,top + vstep,8,8,idnum
idnum = idnum + 1
hstep = hstep + spc
ENDM
vstep = vstep + spc
hstep = 0
ENDM
ENDM
2.
mov hInstance, FUNC(GetModuleHandle,NULL) ---- FUNC() ?
3.
main proc ---- What's the habit/usage to create window? Why not use .rc file?
Dialog "Create Character Table", \ ; caption
"MS Sans Serif",10, \ ; font,pointsize
WS_OVERLAPPED or \ ; styles for
WS_SYSMENU or DS_CENTER, \ ; dialog window
256 + 16 + 8, \ ; number of controls
50,50,203,240, \ ; x y co-ordinates
32768 ; memory buffer size
DlgButton "Numbers", WS_TABSTOP, 21,185,50,13,100
4.
CallModalDialog hInstance,0,DlgProc,NULL ---- CallModalDialog? Where is the defination?
free pMem
5.
mov str1, ustr$(ccntr) ---- ustr$(ccntr) ?
fn SetWindowText,FUNC(GetDlgItem,hWin,nrange),str1 ---- fn?
mov str1,cat$(str1,"Ascii ",str$(ctrl)," Hex ",right$(hex$(ctrl),2)," Character ",str2)
1.
checkarray MACRO cnt1,cnt2,spc,lft,top:REQ
LOCAL idnum,hstep,vstep,lspc,stcnt,var
idnum = 500
stcnt = 400
hstep = 0
vstep = 0
REPEAT cnt1
DlgStatic 0,SS_RIGHT,3,top+vstep,15,8,stcnt
stcnt = stcnt + 1
REPEAT cnt2
DlgCheck 0,0,lft + hstep,top + vstep,8,8,idnum
idnum = idnum + 1
hstep = hstep + spc
ENDM
vstep = vstep + spc
hstep = 0
ENDM
ENDM
checkarray MACRO cnt1,cnt2,spc,lft,top:REQ
LOCAL idnum,hstep,vstep,lspc,stcnt,var
idnum = 500
stcnt = 400
hstep = 0
vstep = 0
REPEAT cnt1
DlgStatic 0,SS_RIGHT,3,top+vstep,15,8,stcnt
stcnt = stcnt + 1
REPEAT cnt2
DlgCheck 0,0,lft + hstep,top + vstep,8,8,idnum
idnum = idnum + 1
hstep = hstep + spc
ENDM
vstep = vstep + spc
hstep = 0
ENDM
ENDM
This macro simplifies the creation of a large ammount of controls (just to save typing). It creates a collection of controls, a single static followed by cnt2 Check Boxes. This is done cnt1 times each time shifting down in order to create a table.
2.
mov hInstance, FUNC(GetModuleHandle,NULL) ---- FUNC() ?
mov hInstance, FUNC(GetModuleHandle,NULL) ---- FUNC() ?
FUNC is a macro defined in MACROS.ASM, it returns the value in EAX after a call to INVOKE:
FUNC MACRO parameters:VARARG
invoke parameters
EXITM <eax>
ENDM
3.
main proc ---- What's the habit/usage to create window? Why not use .rc file?
Dialog "Create Character Table", \ ; caption
"MS Sans Serif",10, \ ; font,pointsize
WS_OVERLAPPED or \ ; styles for
WS_SYSMENU or DS_CENTER, \ ; dialog window
256 + 16 + 8, \ ; number of controls
50,50,203,240, \ ; x y co-ordinates
32768 ; memory buffer size
DlgButton "Numbers", WS_TABSTOP, 21,185,50,13,100
main proc ---- What's the habit/usage to create window? Why not use .rc file?
Dialog "Create Character Table", \ ; caption
"MS Sans Serif",10, \ ; font,pointsize
WS_OVERLAPPED or \ ; styles for
WS_SYSMENU or DS_CENTER, \ ; dialog window
256 + 16 + 8, \ ; number of controls
50,50,203,240, \ ; x y co-ordinates
32768 ; memory buffer size
DlgButton "Numbers", WS_TABSTOP, 21,185,50,13,100
This simplifes the creation of in memory dialogs. You could have created your dialogs in a RC file, but this is how the author decided to create his dialogs. I've not sat down and tested any of that code out but looking DIALOGS.INC I would say that it probably loads up a lot faster than having to find, load, then call a dialog resource. NTM if you didn't have any other resources it could allow you to cut out the resource section all together.
4.
CallModalDialog hInstance,0,DlgProc,NULL ---- CallModalDialog? Where is the defination?
free pMem
CallModalDialog hInstance,0,DlgProc,NULL ---- CallModalDialog? Where is the defination?
free pMem
CallModalDialog is another one of the routines found in Dialogs.inc for in memory dialogs.
; ------------------------------------
; create a modal dialog from the data
; written to the memory template.
; ------------------------------------
CallModalDialog MACRO Instance,Parent,DlgProc,lpExtra
invoke DialogBoxIndirectParam,Instance,esi,Parent,
ADDR DlgProc,lpExtra
push eax ;; preserve return value
invoke GlobalFree,esi ;; free memory
pop eax ;; restore return value
pop edi
pop esi
ENDM
5.
mov str1, ustr$(ccntr) ---- ustr$(ccntr) ?
fn SetWindowText,FUNC(GetDlgItem,hWin,nrange),str1 ---- fn?
mov str1,cat$(str1,"Ascii ",str$(ctrl)," Hex ",right$(hex$(ctrl),2)," Character ",str2)
mov str1, ustr$(ccntr) ---- ustr$(ccntr) ?
fn SetWindowText,FUNC(GetDlgItem,hWin,nrange),str1 ---- fn?
mov str1,cat$(str1,"Ascii ",str$(ctrl)," Hex ",right$(hex$(ctrl),2)," Character ",str2)
ustr$ - converts a string to an unsigned integer
fn - like INVOKE except it lets you use quoted strings
cat$ - catconates strings together
str$ - converts a dword value to a string
hex$ - converts a dword to a hex string
Regards,
Bryant Keller
THX Synfire, I got it! :D
almost everything in the dialogs.inc and macros.asm, and also the hlhelp.hlp :D
Eric
almost everything in the dialogs.inc and macros.asm, and also the hlhelp.hlp :D
Eric
There is a question about the AutoCheckBox:
the macro define 256 autocheckbox
I just want to SetTimer when the 1st(any of the 256) autocheckbox checked, but I don't know how to use the BN_CLICKED notification. I use it below but failed:
the macro define 256 autocheckbox
checkarray MACRO cnt1,cnt2,spc,lft,top:REQ ; checkarray 16,16,10,22,20
LOCAL idnum,hstep,vstep,lspc,stcnt,var
idnum = 500
stcnt = 400
hstep = 0
vstep = 15
REPEAT cnt1 ; cnt1=16
DlgStatic 0,SS_RIGHT,3,top+vstep,15,8,stcnt ; static control, ty=top+vstep=20
stcnt = stcnt + 1
REPEAT cnt2 ; cnt2=16
DlgCheck 0,0,lft + hstep,top + vstep,8,8,idnum ; check box, tx=lft+hstep=22
idnum = idnum + 1
hstep = hstep + spc ; spc=10
ENDM
vstep = vstep + spc
hstep = 0
ENDM
ENDM
I just want to SetTimer when the 1st(any of the 256) autocheckbox checked, but I don't know how to use the BN_CLICKED notification. I use it below but failed:
Case WM_COMMAND
Switch wParam
Case IDOK ; clear
mov nrange, 500
.while nrange <= 755
invoke SendMessage,FUNC(GetDlgItem,hWin,nrange),BM_SETCHECK,BST_UNCHECKED,0
add nrange, 1
.endw
Case IDCANCEL
jmp quit_dialog
Case BN_CLICKED
mov eax,wParam
mov nrange, 500
.while nrange <= 755
invoke IsDlgButtonChecked,FUNC(GetDlgItem,hWin,nrange),nrange
.if eax == BST_CHECKED
invoke SetTimer,hWin,ID_TIMER,5000,NULL
jz @F
.endif
add nrange, 1
.endw
@@:
Default
EndSw
For BN_CLICKED notification wParam consists of notification message id(hiword of wParam) and a control id(loword of wParam).
So your code check wParam against BN_CLICKED meanwhile wParam is something like that : (BN_CLICKED shl 16) or CTRLID.
So your code check wParam against BN_CLICKED meanwhile wParam is something like that : (BN_CLICKED shl 16) or CTRLID.
I tried it several times but failed! :sad:
I get the BN_CLICKED but how can I receive the message and SetTimer when the 1st(any of the 256) autocheckbox checked for that there is no actual handle of them.
any snipplet would be appreciate. I'm really puzzled. :shock:
Thanks in advanced.
I get the BN_CLICKED but how can I receive the message and SetTimer when the 1st(any of the 256) autocheckbox checked for that there is no actual handle of them.
any snipplet would be appreciate. I'm really puzzled. :shock:
Thanks in advanced.
Eric4ever,
Now comes the testing since you have the basic code. I would use a MessageBox to trace results to make sure the flow is according to Hoyle. Move the MessageBox around and with it, you will quickly get to the bottom of it. I am not a fan of this high level approach as it is hard to see what is going on with func, switch and case, etc. Perhaps I am to old fashioned.
Anyway, please keep us posted as I, for one, am interested. Do not forget to shift wParam or you will never get there.
Paul
Now comes the testing since you have the basic code. I would use a MessageBox to trace results to make sure the flow is according to Hoyle. Move the MessageBox around and with it, you will quickly get to the bottom of it. I am not a fan of this high level approach as it is hard to see what is going on with func, switch and case, etc. Perhaps I am to old fashioned.
Anyway, please keep us posted as I, for one, am interested. Do not forget to shift wParam or you will never get there.
Paul