Home > Software engineering >  Mode dialog box of a button can't call OnFileNew CWinApp class function, how to call?
Mode dialog box of a button can't call OnFileNew CWinApp class function, how to call?

Time:10-01

I want to realize the function is in the document view in the program, click on the main window "new" menu, and then pop up a dialog box, set the parameters in the several editor dialog box, click the "ok" button, create a table in a child frame window and display, but I don't know in the dialog box button handler how to invoke CWinApp OnFileNew function of a class, or do not know can call, so it can't go on, the great god, please guide!

CodePudding user response:

OnFileNew no actual meaning, just framework reserved interface
Call is ok, but why call it,
Related functions or to yourself

CodePudding user response:

Fyi:
WM_COMMAND
The WM_COMMAND message is sent when The user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated.

WM_COMMAND
WNotifyCode=HIWORD (wParam);//notification code
WID=LOWORD (wParam);//item, control, or accelerator identifier
LParam hwndCtl=(HWND);//handle of the control

The Parameters
WNotifyCode
The Value of the high - order word of wParam. Specifies the notification code if the message is from a control. If the message is from an accelerator, this parameter is 1. If the message is from a menu, this parameter is 0.
WID
The Value of the low - order word of wParam. Specifies the identifier of the menu item, control, or accelerator.
HwndCtl
Value of lParam. Handle to the control sending the message if the message is from a control. Otherwise, this parameter is NULL.
The Return Values
If an application the processes this message, it should return zero.

Few
Accelerator keystrokes that select the items from the window menu are translated into WM_SYSCOMMAND messages.

If an accelerator keystroke occurs that corresponds to a menu item when the window that owns the menu is minimized, no WM_COMMAND message is sent. Or, If an accelerator keystroke occurs that does not match any of the items in the window 's menu or in the window menu, a WM_COMMAND message is sent, even If the window is minimized.

If an application enables a menu separator, the system sends a WM_COMMAND message with the low word of the wParam parameter is set to zero when the user selects the separator.

QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: the Requires version 1.0 or later.
Header: Declared in winuser. H.

See Also
Edit Controls the Overview, Edit Control Messages, WM_SYSCOMMAND


CodePudding user response:

reference 1st floor xianglitian response:
OnFileNew no actual meaning, just framework reserved interface
Call is ok, but why call it,
Related functions or yourself to achieve


The working process of the main is I don't get OnFileNew, I don't know how to implement the relevant function, don't know the specific steps, so we call this interface function, seek guidance
  • Related