Heres another silly question from the king of silly questions himself:

When i create a modeless dialog box using CreateDialogParam the api says:
Return Value

If the function succeeds, the return value is the window handle of the dialog box.
If the function fails, the return value is NULL.

now if i take this return value:
mov DlgHndl, eax

and use it in my DialogProc thus:

invoke SetDlgItemText,DlgHndl,IDC_EDIT,ADDR DlgName

nothing happens, if i use:

invoke SetDlgItemText,_hWnd,IDC_EDIT,ADDR DlgName

where _hWnd is in the parameter list for DialogProc the txt DlgName comes thru fine.

DlgHndl is a global variable, shouldn't it
a) be available to my dialog procedure even though it's not in the parameter list?
b) work exactly the same way as _hWnd does?


i don't think this has been discussed before here, if so then please kick me, otherwise can anyone tell me why?
Posted on 2003-03-11 18:31:10 by Crunchi
Both handles should be identical, I have used this (obviously extensively) and have never had any problems of this type. Could you post your dialog creation code - does it look like this?

invoke CreateDialogParam, hInstance, ADDR DlgName, NULL, NULL, NULL
test eax,eax
jnz @F
invoke GetLastError
ret
@@:
mov hDlg, eax

If your dialog is displaying then the function suceeded, you should check for a NULL return in eax though.

Donkey
Posted on 2003-03-11 18:48:23 by donkey
thanx donkey,

i got the problem sorted, i was calling createdialogparam from another funtion and i thought i was returning the handle to my main prodcedure where i was then saving the value, if i save the value in the function i"m calling createdialogparam from, it all works.
Posted on 2003-03-11 19:33:08 by Crunchi