Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifdef __WXMSW__
- #include <Windows.h>
- #include <CommCtrl.h>
- #include <wx/msw/private.h>
- typedef int (WINAPI *func_LoadIconWithScaleDown)(HINSTANCE, LPCWSTR, int, int, HICON*);
- #endif
- void MainFrame::BindAppIcon() {
- #ifdef __WXMSW__
- wxDynamicLibrary comctl32("comctl32", wxDL_DEFAULT | wxDL_QUIET);
- func_LoadIconWithScaleDown load_icon_scaled = reinterpret_cast<func_LoadIconWithScaleDown>(comctl32.GetSymbol("LoadIconWithScaleDown"));
- int icon_set_count = 0;
- HICON hIconLg;
- if (load_icon_scaled && SUCCEEDED(load_icon_scaled(wxGetInstance(), _T("AAAAA_MAINICON"), ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), &hIconLg))) {
- ::SendMessage(GetHandle(), WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(hIconLg));
- ++icon_set_count;
- }
- HICON hIconSm;
- if (load_icon_scaled && SUCCEEDED(load_icon_scaled(wxGetInstance(), _T("AAAAA_MAINICON"), ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), &hIconSm))) {
- ::SendMessage(GetHandle(), WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(hIconSm));
- ++icon_set_count;
- }
- if (icon_set_count == 2) return;
- // otherwise fall back to Wx method of setting icon
- #endif
- wxIcon icon = wxXmlResource::Get()->LoadIcon(wxT("MainIcon"));
- if (!icon.IsOk()) {
- wxLogInfo(_("Main icon not found"));
- icon = wxICON(wxvbam);
- }
- SetIcon(icon);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement