According to the msdn documentation, the parameter Meanings of the create function are as follows:
Virtual bool create (
Lpctstr lpszcaption,
DWORD dwstyle,
Const rect & rect,
Cwnd * pparentwnd,
Uint Nid
);
Lpszcaption
Specifies the text of the button control.
Dwstyle
Specifies the style of the button control. Applies to any combination of Button styles.
Rect
Specifies the size and position of the button control. It can beCrectObject orRectStructure.
Pparentwnd
Specifies the parent window of the button control, usuallyCdialog. Cannot beNull.
Nid
ID of the button control.
I mean the problem I encountered when using this function:
(1) The first parameter is the control text. On the internet, double quotation marks are directly used: "window". However, vs2013 will report an error. Just use text ("window ").
(2) create a cbutton object btn in the oncreate method and call BTN. create method creation button, run, you will find that the button is not displayed, why, because the BTN object we created is a local variable, when the oncreate method ends, BTN destructor, recycle window resources, and click destroy. Therefore, we need to define cbutton as a global variable.
(3) after calling the create method of BTN, you must call the showwindow method to display the button. You can use this method to add the ws_visible type to the second parameter of create.
Zookeeper
Cbutton class create function usage