mirror of
https://github.com/reactos/reactos.git
synced 2024-06-19 11:19:47 +00:00
[REACTOS] Do not free shared icon for ShellAbout() calls (#5519)
CORE-18369
This commit is contained in:
parent
815d55c378
commit
016acd170d
|
@ -1945,9 +1945,9 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
|
||||||
hInstance,
|
hInstance,
|
||||||
MAKEINTRESOURCE(IDI_CALC),
|
MAKEINTRESOURCE(IDI_CALC),
|
||||||
IMAGE_ICON,
|
IMAGE_ICON,
|
||||||
GetSystemMetrics(SM_CXICON),
|
0,
|
||||||
GetSystemMetrics(SM_CYICON),
|
0,
|
||||||
0);
|
LR_DEFAULTSIZE | LR_SHARED);
|
||||||
|
|
||||||
calc.hSmIcon = LoadImage(
|
calc.hSmIcon = LoadImage(
|
||||||
hInstance,
|
hInstance,
|
||||||
|
@ -1955,7 +1955,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
|
||||||
IMAGE_ICON,
|
IMAGE_ICON,
|
||||||
GetSystemMetrics(SM_CXSMICON),
|
GetSystemMetrics(SM_CXSMICON),
|
||||||
GetSystemMetrics(SM_CYSMICON),
|
GetSystemMetrics(SM_CYSMICON),
|
||||||
0);
|
LR_SHARED);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* ignore hwnd: dialogs are already visible! */
|
/* ignore hwnd: dialogs are already visible! */
|
||||||
|
@ -1985,12 +1985,6 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
|
||||||
save_config();
|
save_config();
|
||||||
} while (calc.action != IDC_STATIC);
|
} while (calc.action != IDC_STATIC);
|
||||||
|
|
||||||
if (calc.hBgIcon != NULL)
|
|
||||||
DestroyIcon(calc.hBgIcon);
|
|
||||||
|
|
||||||
if (calc.hSmIcon != NULL)
|
|
||||||
DestroyIcon(calc.hSmIcon);
|
|
||||||
|
|
||||||
stop_rpn_engine();
|
stop_rpn_engine();
|
||||||
|
|
||||||
Theme_Stop();
|
Theme_Stop();
|
||||||
|
|
|
@ -248,13 +248,11 @@ static int OnCommand(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
case CMD_ABOUT:
|
case CMD_ABOUT:
|
||||||
{
|
{
|
||||||
HICON hIcon;
|
|
||||||
WCHAR szTitle[MAX_STRING_LEN];
|
WCHAR szTitle[MAX_STRING_LEN];
|
||||||
|
|
||||||
hIcon = LoadIconW(Globals.hInstance, MAKEINTRESOURCE(CLIPBRD_ICON));
|
|
||||||
LoadStringW(Globals.hInstance, STRING_CLIPBOARD, szTitle, ARRAYSIZE(szTitle));
|
LoadStringW(Globals.hInstance, STRING_CLIPBOARD, szTitle, ARRAYSIZE(szTitle));
|
||||||
ShellAboutW(Globals.hMainWnd, szTitle, NULL, hIcon);
|
ShellAboutW(Globals.hMainWnd, szTitle, NULL,
|
||||||
DeleteObject(hIcon);
|
LoadIconW(Globals.hInstance, MAKEINTRESOURCEW(CLIPBRD_ICON)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1439,9 +1439,8 @@ MainWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
case IDM_ABOUT:
|
case IDM_ABOUT:
|
||||||
{
|
{
|
||||||
HICON mplayIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIN));
|
ShellAbout(hwnd, szAppTitle, NULL,
|
||||||
ShellAbout(hwnd, szAppTitle, NULL, mplayIcon);
|
LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIN)));
|
||||||
DeleteObject(mplayIcon);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3640,13 +3640,11 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
case IDM_ABOUT:
|
case IDM_ABOUT:
|
||||||
{
|
{
|
||||||
HICON hIcon;
|
|
||||||
WCHAR szCopyright[MAX_LOADSTRING];
|
WCHAR szCopyright[MAX_LOADSTRING];
|
||||||
|
|
||||||
hIcon = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_EVENTVWR));
|
|
||||||
LoadStringW(hInst, IDS_COPYRIGHT, szCopyright, ARRAYSIZE(szCopyright));
|
LoadStringW(hInst, IDS_COPYRIGHT, szCopyright, ARRAYSIZE(szCopyright));
|
||||||
ShellAboutW(hWnd, szTitle, szCopyright, hIcon);
|
ShellAboutW(hWnd, szTitle, szCopyright,
|
||||||
DeleteObject(hIcon);
|
LoadIconW(hInst, MAKEINTRESOURCEW(IDI_EVENTVWR)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,6 @@ MainWndCommand(PMAIN_WND_INFO Info,
|
||||||
{
|
{
|
||||||
WCHAR szAppName[256];
|
WCHAR szAppName[256];
|
||||||
WCHAR szAppAuthors[256];
|
WCHAR szAppAuthors[256];
|
||||||
HICON hIcon;
|
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(hControl);
|
UNREFERENCED_PARAMETER(hControl);
|
||||||
|
|
||||||
|
@ -597,9 +596,8 @@ MainWndCommand(PMAIN_WND_INFO Info,
|
||||||
LoadStringW(hInstance, IDS_APPNAME, szAppName, _countof(szAppName));
|
LoadStringW(hInstance, IDS_APPNAME, szAppName, _countof(szAppName));
|
||||||
LoadStringW(hInstance, IDS_APPAUTHORS, szAppAuthors, _countof(szAppAuthors));
|
LoadStringW(hInstance, IDS_APPAUTHORS, szAppAuthors, _countof(szAppAuthors));
|
||||||
|
|
||||||
hIcon = LoadIconW(hInstance, MAKEINTRESOURCEW(IDI_SM_ICON));
|
ShellAboutW(Info->hMainWnd, szAppName, szAppAuthors,
|
||||||
ShellAboutW(Info->hMainWnd, szAppName, szAppAuthors, hIcon);
|
LoadIconW(hInstance, MAKEINTRESOURCEW(IDI_SM_ICON)));
|
||||||
DestroyIcon(hIcon);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -599,13 +599,12 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||||
{
|
{
|
||||||
case IDM_HELPINFO:
|
case IDM_HELPINFO:
|
||||||
{
|
{
|
||||||
HICON paintIcon = LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON));
|
|
||||||
TCHAR infotitle[100];
|
TCHAR infotitle[100];
|
||||||
TCHAR infotext[200];
|
TCHAR infotext[200];
|
||||||
LoadString(g_hinstExe, IDS_INFOTITLE, infotitle, _countof(infotitle));
|
LoadString(g_hinstExe, IDS_INFOTITLE, infotitle, _countof(infotitle));
|
||||||
LoadString(g_hinstExe, IDS_INFOTEXT, infotext, _countof(infotext));
|
LoadString(g_hinstExe, IDS_INFOTEXT, infotext, _countof(infotext));
|
||||||
ShellAbout(m_hWnd, infotitle, infotext, paintIcon);
|
ShellAbout(m_hWnd, infotitle, infotext,
|
||||||
DeleteObject(paintIcon);
|
LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDM_HELPHELPTOPICS:
|
case IDM_HELPHELPTOPICS:
|
||||||
|
|
|
@ -138,19 +138,14 @@ DWORD WINAPI OSK_WarningDlgThread(LPVOID lpParameter)
|
||||||
VOID OSK_About(VOID)
|
VOID OSK_About(VOID)
|
||||||
{
|
{
|
||||||
WCHAR szAuthors[MAX_PATH];
|
WCHAR szAuthors[MAX_PATH];
|
||||||
HICON OSKIcon;
|
|
||||||
|
|
||||||
/* Load the icon */
|
|
||||||
OSKIcon = LoadImageW(Globals.hInstance, MAKEINTRESOURCEW(IDI_OSK), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
|
|
||||||
|
|
||||||
/* Load the strings into the "About" dialog */
|
/* Load the strings into the "About" dialog */
|
||||||
LoadStringW(Globals.hInstance, IDS_AUTHORS, szAuthors, _countof(szAuthors));
|
LoadStringW(Globals.hInstance, IDS_AUTHORS, szAuthors, _countof(szAuthors));
|
||||||
|
|
||||||
|
/* Load the icon */
|
||||||
/* Finally, execute the "About" dialog by using the Shell routine */
|
/* Finally, execute the "About" dialog by using the Shell routine */
|
||||||
ShellAboutW(Globals.hMainWnd, Globals.szTitle, szAuthors, OSKIcon);
|
ShellAboutW(Globals.hMainWnd, Globals.szTitle, szAuthors,
|
||||||
|
LoadImageW(Globals.hInstance, MAKEINTRESOURCEW(IDI_OSK), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED));
|
||||||
/* Once done, destroy the icon */
|
|
||||||
DestroyIcon(OSKIcon);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
|
@ -469,13 +469,11 @@ CMainWindow::ShowAboutDlg()
|
||||||
{
|
{
|
||||||
CStringW szApp;
|
CStringW szApp;
|
||||||
CStringW szAuthors;
|
CStringW szAuthors;
|
||||||
HICON hIcon;
|
|
||||||
|
|
||||||
szApp.LoadStringW(IDS_APPTITLE);
|
szApp.LoadStringW(IDS_APPTITLE);
|
||||||
szAuthors.LoadStringW(IDS_APP_AUTHORS);
|
szAuthors.LoadStringW(IDS_APP_AUTHORS);
|
||||||
hIcon = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_MAIN));
|
ShellAboutW(m_hWnd, szApp, szAuthors,
|
||||||
ShellAboutW(m_hWnd, szApp, szAuthors, hIcon);
|
LoadIconW(hInst, MAKEINTRESOURCEW(IDI_MAIN)));
|
||||||
DestroyIcon(hIcon);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -432,7 +432,6 @@ WndProc(HWND hWnd,
|
||||||
HFONT oldfont;
|
HFONT oldfont;
|
||||||
long long slid_samp = 0;
|
long long slid_samp = 0;
|
||||||
WCHAR szAppName[100];
|
WCHAR szAppName[100];
|
||||||
HICON hIcon;
|
|
||||||
|
|
||||||
/* Checking for global pointers to buffer and io audio devices */
|
/* Checking for global pointers to buffer and io audio devices */
|
||||||
if ((!AUD_IN) || (!AUD_OUT) || (!AUD_BUF))
|
if ((!AUD_IN) || (!AUD_OUT) || (!AUD_BUF))
|
||||||
|
@ -598,9 +597,8 @@ WndProc(HWND hWnd,
|
||||||
|
|
||||||
case ID_ABOUT:
|
case ID_ABOUT:
|
||||||
LoadStringW(hInst, IDS_APP_TITLE, szAppName, _countof(szAppName));
|
LoadStringW(hInst, IDS_APP_TITLE, szAppName, _countof(szAppName));
|
||||||
hIcon = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_REACTOS_SNDREC32));
|
ShellAboutW(hWnd, szAppName, NULL,
|
||||||
ShellAboutW(hWnd, szAppName, NULL, hIcon);
|
LoadIconW(hInst, MAKEINTRESOURCEW(IDI_REACTOS_SNDREC32)));
|
||||||
DestroyIcon(hIcon);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_FILE_SAVEAS:
|
case ID_FILE_SAVEAS:
|
||||||
|
|
|
@ -10,9 +10,8 @@
|
||||||
void OnAbout(void)
|
void OnAbout(void)
|
||||||
{
|
{
|
||||||
WCHAR szTaskmgr[128];
|
WCHAR szTaskmgr[128];
|
||||||
HICON taskmgrIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TASKMANAGER));
|
|
||||||
|
|
||||||
LoadStringW(hInst, IDS_APP_TITLE, szTaskmgr, sizeof(szTaskmgr)/sizeof(WCHAR));
|
LoadStringW(hInst, IDS_APP_TITLE, szTaskmgr, sizeof(szTaskmgr)/sizeof(WCHAR));
|
||||||
ShellAboutW(hMainWnd, szTaskmgr, NULL, taskmgrIcon);
|
ShellAboutW(hMainWnd, szTaskmgr, NULL,
|
||||||
DeleteObject(taskmgrIcon);
|
LoadIconW(hInst, MAKEINTRESOURCEW(IDI_TASKMANAGER)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -653,16 +653,13 @@ CDeviceManager::OnCommand(_In_ WPARAM wParam,
|
||||||
{
|
{
|
||||||
CAtlStringW szAppName;
|
CAtlStringW szAppName;
|
||||||
CAtlStringW szAppAuthors;
|
CAtlStringW szAppAuthors;
|
||||||
HICON hIcon;
|
|
||||||
|
|
||||||
if (!szAppName.LoadStringW(g_hThisInstance, IDS_APPNAME))
|
if (!szAppName.LoadStringW(g_hThisInstance, IDS_APPNAME))
|
||||||
szAppName = L"ReactOS Device Manager";
|
szAppName = L"ReactOS Device Manager";
|
||||||
if (!szAppAuthors.LoadStringW(g_hThisInstance, IDS_APP_AUTHORS))
|
if (!szAppAuthors.LoadStringW(g_hThisInstance, IDS_APP_AUTHORS))
|
||||||
szAppAuthors = L"";
|
szAppAuthors = L"";
|
||||||
hIcon = LoadIconW(g_hThisInstance, MAKEINTRESOURCEW(IDI_MAIN_ICON));
|
ShellAboutW(m_hMainWnd, szAppName, szAppAuthors,
|
||||||
ShellAboutW(m_hMainWnd, szAppName, szAppAuthors, hIcon);
|
LoadIconW(g_hThisInstance, MAKEINTRESOURCEW(IDI_MAIN_ICON)));
|
||||||
if (hIcon)
|
|
||||||
DestroyIcon(hIcon);
|
|
||||||
|
|
||||||
// Set focus back to the treeview
|
// Set focus back to the treeview
|
||||||
m_DeviceView->SetFocus();
|
m_DeviceView->SetFocus();
|
||||||
|
|
Loading…
Reference in a new issue