CUserControl

独自のコントロール、CUserControlを追加し、CMainWindowの子ウィンドウとして配置する。
UserControl.hを追加し、

こう書く。
UserControl.cppは、

と書く。
Createの中では、ウィンドウスタイルとしてdwStyleにWS_CHILDとWS_VISIBLEが追加される。
MainWindow.hは、

CUserControlオブジェクトポインタを追加。
また、コンストラクタやデストラクタも追加。
MainWindow.cppは、

OnCreateで、CUserControlオブジェクトを作成し、ウィンドウ作成もする。
OnDestroyで、CUserControlオブジェクトを破棄。
一応、デストラクタでも破棄処理はしてるけど、基本いらない。
MainApplication.cppで、

CUserControl::RegisterClassで"CUserControl"ウィンドウクラスを登録。

起動時
起動時

起動時。

この黒枠の矩形がCUserControl
この黒枠の矩形がCUserControl

この黒枠の矩形がCUserControl。

終了時
終了時

終了時。
このようになる。

Test/winapi/CUserControl/CUserControl/src/CUserControl at master · bg1bgst333/Test · GitHub