hey,
well i have my dialog now right.
so how do i navigate form one dialog to the next, like i click the button, how would i make it delete the first dialog and goto the next one?

thanks,
njkt
Posted on 2003-08-05 12:37:34 by njkt809
hey sorry i found the info out already, i just couldnt delte it yet,

anyways,

how would i delete a dialog window once a new one is created?

thanks,
njkt
Posted on 2003-08-05 22:20:20 by njkt809
Send it a WM_CLOSE message or hide it using invoke ShowWindow,hDlg,SW_HIDE
Posted on 2003-08-05 22:25:47 by donkey
hey,
i used the WM_CLOSE but it close both,
i have 2 dialogs going,

when i click the ok button it closes both dialogs,
when i click the X on the second dialog it closes the first and leaves the second :(

heres the code i used


.elseif eax==IDM_HELP_ABOUT
invoke DialogBoxParam,hInstance,IDD_DIALOG1,NULL,addr DlgProc,NULL
-------------------------------

DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

mov eax,uMsg
.if eax==WM_INITDIALOG
invoke SetFocus,eax
.elseif eax==WM_COMMAND
mov eax,wParam
mov edx,eax
shr edx,16
.if dx==BN_CLICKED
.if eax==IDC_BTNOK
invoke SendMessage,hWnd,WM_CLOSE,NULL,NULL
.endif
.endif
.elseif eax==WM_CLOSE
invoke EndDialog,hWnd,NULL
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret

DlgProc endp
---------------------------------------------------------------------
rsrc.rc
----------------
#define IDD_DIALOG1 101
#define IDC_STC1 1001
#define IDC_BTNOK 4000
#define IDC_STC2 1003
#define IDC_STC3 1004
IDD_DIALOG1 DIALOGEX 6,6,194,102
CAPTION "About"
FONT 8,"MS Sans Serif"
STYLE 0x10CE0800
EXSTYLE 0x00000000
BEGIN
LTEXT "I created this game for mine and my friends enjoyment.",IDC_STC1,18,7,150,19,NOT 0x00830000|0x50000001,0x00000000
PUSHBUTTON "Ok",IDC_BTNOK,70,79,52,19,NOT 0x00820000|0x50010000,0x00020000
LTEXT "Contact:[imgmail]http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=437f27ff48b890d37635d891c5798cd0[/imgmail]",IDC_STC2,36,62,116,11,NOT 0x00830000|0x50000001,0x00000000
LTEXT "Created by: Nick Johns",IDC_STC3,16,33,150,19,NOT 0x00830000|0x50000001,0x00000000
END
-----------------------------



thanks,
njkt
Posted on 2003-08-05 23:00:27 by njkt809
You cannot close your main dialog until you want to exit the program. If you are using the same DialogProc for both then both will close. Use ShowWindow instead, without knowing the flow of your program I can't really give you any credible advice, it depends on how the dialogs are created, where their WindowProcs are, the parents of the dialogs, their classes etc.. just be sure not to send a close to any proc that will post a quit message in the handler. For the most part your dialogs should be dismissing themselves, you have only to hide their parents in the WM_CREATE handler.
Posted on 2003-08-05 23:26:05 by donkey
hey,
well i think ive made it wrong,
since this is my first time using dialogs instead of windows.
u can take a look at the source if u want.
cuz i dono what wrong with it, probably bad coding on my part.

later,
njkt
Posted on 2003-08-06 00:18:50 by njkt809
I'll have a look but I can't gaurantee when, probably tommorow.
Posted on 2003-08-06 00:20:43 by donkey
ok thanks,
haha i have alot of time on my hands at the moment, haha thank god for summer vacation.

njkt
Posted on 2003-08-06 00:22:32 by njkt809
When you send the message WM_CLOSE to hwnd, you are closing the main window.

Try somethnig like
DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM


mov eax,uMsg
.if eax==WM_INITDIALOG
invoke SetFocus,eax
.elseif eax==WM_COMMAND
mov eax,wParam
and eax, 0ffffh
cmp eax, IDC_BTNOK
jz _close

.elseif eax==WM_CLOSE
_close:
invoke EndDialog,hWnd,NULL
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret

DlgProc endp


Do mind my editing since I am not used to .if and .endif stuffs.
Posted on 2003-08-06 02:46:47 by roticv
Well, I made a few notes, just first glance stuff. I haven't re-assembled or tested it or anything but there are a few ideas for you to think about, this is just the asm file :
Posted on 2003-08-06 03:48:45 by donkey
ok thanks,
im looking at itall right now.

njkt
Posted on 2003-08-06 12:34:53 by njkt809
hey,
i figured it out,
it was the .rc
i had both dialogs using the same id number :o

but anyways,
still when i press the ex on the second one the main gets deleted.

and aslo,
how would i send data into an EditText box?

later,
njkt
Posted on 2003-08-06 22:00:28 by njkt809
and aslo,
how would i send data into an EditText box?


Use SetDlgItemInt or SetDlgItemText depending on data type.
Posted on 2003-08-07 02:31:06 by roticv
hey,
do u have any examples for both?
for the int im going to be dealing with 1-5 digits
and the text will be used for names.

thanks,
njkt
Posted on 2003-08-07 12:20:32 by njkt809
I don't have my docs here, but if I remember well:

To set a number in an edit box:
invoke SetDlgItemInt,hDlg,CtrlID,Number,bSigned

Where:
hDlg: Handle to dialog box
CtrlID: ID of the edit box control
Number: self evident :)
bSigned: TRUE for signed integers, FALSE for unsigned

To set a text in a edit box:
invoke SetDlgItemText,hDlg,CtrlID,pText

Where:
hDlg: Handle to dialog box
CtrlID: ID of the edit box control
pText: Pointer to ASCIIZ text (that would be something like "offset MyBuffer")

If it doesn't work, please check Microsoft docs, in case I made a mistake.

EDIT: I forgot about MSDN... I checked it online, and it was correct.
Posted on 2003-08-07 12:49:10 by QvasiModo
ok those work thanks,

but then how would i be able to take the input from the user (the name)
and then put it into the edit box?

thanks.
njkt
Posted on 2003-08-07 13:00:48 by njkt809
You mean to copy the contents of an edit box into your buffer? You can use GetDlgItemText and GetDlgItemInt for that. The user should edit the contents of the edit box... I haven't seen your code, but I'm assuming you have a dialog box where you prompt the user for a name and a number.
Posted on 2003-08-07 13:10:07 by QvasiModo
yes,
for the name only.
but the name is going to be a perminemt string
because its going to be called everytime the user clicks on the button.
Posted on 2003-08-07 13:13:56 by njkt809
ok so the command should be like this;

invoke GetDlgItemText,hwndEdit,ADDR buffer,512

?

what are the parameters for this call though?
Posted on 2003-08-07 13:33:14 by njkt809
Nope. When you have the "DlgItem" functions, you need to pass them a handle to the dialog box, and the control Id; when you have a "Window" function, you pass it a window handle. This is useful so you don't have to retreive the controls handle every time. Remember that the API was meant to be used from C, and C programmers often code their dialog boxes with resource scripts, not by calling CreateWindow, so getting the handle of each control would mean more work.

For example, GetWindowText asks for a window (or control) handle, and GetDlgItemText asks for a dialog box handle and an item ID.

Here's the MSDN reference for this APIs:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/getdlgitemtext.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/getdlgitemint.asp
Posted on 2003-08-07 13:40:04 by QvasiModo