CApplication

InitInstance、Run、ExitInstance、これらのアプリケーションに関する処理をCApplicationクラスにまとめる。
(MFCでいうところのCWinAppに相当する。)
まず、Application.hは、

CApplicationクラスのメンバに、InitInstance、Run、ExitInstance、を追加する。
WindowProcは、簡単にメンバ化できないので、とりあえず普通の非メンバな関数として宣言を書いておく。
Application.cppは、

これまでのWinMainから、中身をほぼそのまま持ってくる。
メンバではないが、WindowProcも持ってくる。
そうすると、WinMain.cppは、

こんなにすっきりする。

ウィンドウの表示は変わらない
ウィンドウの表示は変わらない

ウィンドウの表示は変わらない。

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