- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
On a Dialog, when click OK button, I want to create a file which saves all the setting on that Dialog. I can do it with other kind of Buttons, but not the OK button. What is the function behind OK_Clicked where I could insert my code?
I have read these, but haven't found a clue.
Setting Return Values and Exiting (intel.com)
Cheers,
Cean
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have no idea what tDLG is. Somewhere you call DLGMODAL. This is a function that returns an integer value of the action that caused the dialog to close, so you could check it against IDOK. The About dialog is not the place to do this.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are using modal dialog, you can take action when that call returns. If it's a modeless dialog, then Microsoft's recommendation is that you use a Close menu item or button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
case (ID_FILE_TDIALOG)
!hDC = GetDC(hwnd)
call tDLG()
!ret=tDLG() !not working
open (6,file='d:\1.txt')
write (6,*) ret
close (6)
return
case (IDM_ABOUT)
lpszName = "AboutDlg"C
ret = DialogBoxParam(ghInstance,LOC(lpszName),hWnd,&
LOC(AboutDlgProc), 0_LONG_PTR)
MainWndProc = 0
return
IDOK is checked inside AboutDlgProc.
Is this the way I need to follow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have no idea what tDLG is. Somewhere you call DLGMODAL. This is a function that returns an integer value of the action that caused the dialog to close, so you could check it against IDOK. The About dialog is not the place to do this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
tDLG is my Dialog.
"Somewhere you call DLGMODAL."
This solved my question. Use below code, I can see the return value is different between OK and Cancel.
iSt = DlgModal(Dlg)
open (6,file='d:\00file\1.txt')
write (6,*) iSt
close (6)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes the return is IDOK or IDCANCEL or a user defined return value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The OK button is "IDOK" control index so you can process that case in the dlgproc if you want to to some pre-exit activity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would advise against doing anything time-consuming in a dlgproc. You could set a flag or store some info that can be used once the dialog box exits.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page