WM_GETFONTで、フォントハンドルを取得する。
WM_GETFONT メッセージ (Winuser.h) - Win32 apps | Microsoft Learn
メニューリソースに、
Item2と、その下のItem2-1を追加。
WM_GETFONT.cppでは、
Item2-1が選択されたら、フォントハンドルと文字の高さを表示。
SelectObjectでhDCに取得したhFontを選択させないと、TEXTMETRIC構造体tmに反映されないので注意。
![hFont1はこれ](https://cdn-ak.f.st-hatena.com/images/fotolife/B/BG1/20221208/20221208141636.png)
hFont1はこれ。
![hFont2はこれ](https://cdn-ak.f.st-hatena.com/images/fotolife/B/BG1/20221208/20221208141707.png)
hFont2はこれ。
![Item2-1を選択](https://cdn-ak.f.st-hatena.com/images/fotolife/B/BG1/20221208/20221208141747.png)
Item2-1を選択。
![hFont1と同じ。高さは30。](https://cdn-ak.f.st-hatena.com/images/fotolife/B/BG1/20221208/20221208141825.png)
hFont1と同じ。高さは30。
![Item1-2を選択](https://cdn-ak.f.st-hatena.com/images/fotolife/B/BG1/20221208/20221208141919.png)
Item1-2を選択。
![Item2-1を選択](https://cdn-ak.f.st-hatena.com/images/fotolife/B/BG1/20221208/20221208141952.png)
Item2-1を選択。
![hFont2と同じ。高さは40。](https://cdn-ak.f.st-hatena.com/images/fotolife/B/BG1/20221208/20221208142053.png)
hFont2と同じ。高さは40。
Sample/winapi/WM_GETFONT/WM_GETFONT/src/WM_GETFONT at master · bg1bgst333/Sample · GitHub