07-09-2019, 04:35 PM
If I have dialog in a function called "test_return_value", how can I return any value (negative, 0 or positive) upon pressing a button in that dialog?
For example the below dialog, see button text. (Preferably without using thread/global vairables.)
If want to use the function "test_return_value" function like this:
I can't do it with: DT_Ret(hDlg -77), DT_Ok(hDlg -77), DT_EndDialog(hDlg -77), ...
(if it is possible, then I am using in an incorrect way).
Function test_return_value
For example the below dialog, see button text. (Preferably without using thread/global vairables.)
If want to use the function "test_return_value" function like this:
I can't do it with: DT_Ret(hDlg -77), DT_Ok(hDlg -77), DT_EndDialog(hDlg -77), ...
(if it is possible, then I am using in an incorrect way).
Function test_return_value
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Button 0x54032000 0x0 72 44 86 39 "upon pressing this button, close this dialog and return -77"
;END DIALOG
;DIALOG EDITOR: "" 0x2040601 "*" "" "" ""
if(!ShowDialog(dd &sub.DlgProc 0)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 3
,,;; When this button is pressed
,,;; 1. Close this dialog
,,;; 2. Return: -77
,,;; ...
ret 1