【WinAPI】C++ ウィンドウの背景色を取得する方法
メモ
ウィンドウクラスの登録時に指定する、背景色ブラシからRGBカラーを取り出す。
実装
auto hb = reinterpret_cast<HBRUSH>(::GetClassLong(m_hWnd, GCL_HBRBACKGROUND)); LOGBRUSH br{}; if (::GetObject(hb, sizeof(br), &br)) { BYTE r = GetRValue(br.lbColor); BYTE g = GetGValue(br.lbColor); BYTE b = GetBValue(br.lbColor); }