- unregister task manager window at termination

svn path=/trunk/; revision=14190
This commit is contained in:
Martin Fuchs 2005-03-19 09:37:46 +00:00
parent cf95dc8b1b
commit e24c42bb6b
4 changed files with 30 additions and 28 deletions

View file

@ -25,8 +25,8 @@ TARGET_CPPFLAGS := $(TARGET_CFLAGS)
TARGET_RCFLAGS := -D__USE_W32API -DWIN32 -D_ROS_ -D__WINDRES__ TARGET_RCFLAGS := -D__USE_W32API -DWIN32 -D_ROS_ -D__WINDRES__
TARGET_SDKLIBS := \ TARGET_SDKLIBS := \
gdi32.a comctl32.a ole32.a oleaut32.a shell32.a expat.a \ gdi32.a user32.a comctl32.a ole32.a oleaut32.a shell32.a expat.a \
notifyhook.a ws2_32.a msimg32.a user32.a notifyhook.a ws2_32.a msimg32.a
TARGET_GCCLIBS := stdc++ uuid TARGET_GCCLIBS := stdc++ uuid

View file

@ -28,3 +28,9 @@
- Search Programs -> performance monitor.msv -> Abort - Search Programs -> performance monitor.msv -> Abort
<Nonvo> Martin, I would have a whish concerning explorer: I often want to start a program and give it some parameters. So nice featue: "Start with param..."
<tinus_> Nonvo: shell extension
<m-fuchs> tinus: we should think about installing some default shell extensions
<tinus_> m-fuchs: perhaps, but it'd be nice if they actually were shell extensions

View file

@ -729,6 +729,14 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
RegSetValueEx(hkey, TEXT("Shell"), 0, REG_SZ, (LPBYTE)path, l*sizeof(TCHAR)); RegSetValueEx(hkey, TEXT("Shell"), 0, REG_SZ, (LPBYTE)path, l*sizeof(TCHAR));
RegCloseKey(hkey); RegCloseKey(hkey);
} }
if (!RegOpenKey(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"), &hkey)) {
///@todo save previous shell application in config file
RegSetValueEx(hkey, TEXT("Shell"), 0, REG_SZ, (LPBYTE)TEXT(""), l*sizeof(TCHAR));
RegCloseKey(hkey);
}
} }
HWND shellWindow = GetShellWindow(); HWND shellWindow = GetShellWindow();

View file

@ -32,6 +32,11 @@
#include "traynotify.h" // for NOTIFYAREA_WIDTH_DEF #include "traynotify.h" // for NOTIFYAREA_WIDTH_DEF
DynamicFct<BOOL (WINAPI*)(HWND hwnd)> g_SetTaskmanWindow(TEXT("user32"), "SetTaskmanWindow");
DynamicFct<BOOL (WINAPI*)(HWND hwnd)> g_RegisterShellHookWindow(TEXT("user32"), "RegisterShellHookWindow");
DynamicFct<BOOL (WINAPI*)(HWND hwnd)> g_DeregisterShellHookWindow(TEXT("user32"), "DeregisterShellHookWindow");
TaskBarEntry::TaskBarEntry() TaskBarEntry::TaskBarEntry()
{ {
_id = 0; _id = 0;
@ -61,12 +66,13 @@ TaskBar::TaskBar(HWND hwnd)
TaskBar::~TaskBar() TaskBar::~TaskBar()
{ {
DynamicFct<BOOL (WINAPI*)(HWND hwnd)> DeregisterShellHookWindow(TEXT("user32"), "DeregisterShellHookWindow"); if (g_DeregisterShellHookWindow)
(*g_DeregisterShellHookWindow)(_hwnd);
if (DeregisterShellHookWindow)
(*DeregisterShellHookWindow)(_hwnd);
else else
KillTimer(_hwnd, 0); KillTimer(_hwnd, 0);
if (g_SetTaskmanWindow)
(*g_SetTaskmanWindow)(0);
} }
HWND TaskBar::Create(HWND hwndParent) HWND TaskBar::Create(HWND hwndParent)
@ -100,15 +106,13 @@ LRESULT TaskBar::Init(LPCREATESTRUCT pcs)
_next_id = IDC_FIRST_APP; _next_id = IDC_FIRST_APP;
// register ourselved as task manager window to make the following call to RegisterShellHookWindow working // register ourselved as task manager window to make the following call to RegisterShellHookWindow working
DynamicFct<BOOL (WINAPI*)(HWND hwnd)> SetTaskmanWindow(TEXT("user32"), "SetTaskmanWindow"); if (g_SetTaskmanWindow)
if (SetTaskmanWindow) (*g_SetTaskmanWindow)(_hwnd);
(*SetTaskmanWindow)(_hwnd);
DynamicFct<BOOL (WINAPI*)(HWND hwnd)> RegisterShellHookWindow(TEXT("user32"), "RegisterShellHookWindow"); if (g_RegisterShellHookWindow) {
if (RegisterShellHookWindow) {
LOG(TEXT("Using shell hooks for notification of shell events.")); LOG(TEXT("Using shell hooks for notification of shell events."));
(*RegisterShellHookWindow)(_hwnd); (*g_RegisterShellHookWindow)(_hwnd);
} else { } else {
LOG(TEXT("Shell hooks not available.")); LOG(TEXT("Shell hooks not available."));
SetTimer(_hwnd, 0, 200, NULL); SetTimer(_hwnd, 0, 200, NULL);
@ -139,23 +143,7 @@ LRESULT TaskBar::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
break; // avoid displaying context menu for application button _and_ desktop bar at the same time break; // avoid displaying context menu for application button _and_ desktop bar at the same time
goto def;} goto def;}
/*
//#define PM_SHELLHOOK_NOTIFY (WM_APP+0x10)
case PM_SHELLHOOK_NOTIFY: {
int code = lparam;
switch(code) {
case HSHELL_WINDOWCREATED:
case HSHELL_WINDOWDESTROYED:
case HSHELL_WINDOWACTIVATED:
case HSHELL_WINDOWREPLACED:
Refresh();
break;
}
Refresh();
break;}
*/
case PM_GET_LAST_ACTIVE: case PM_GET_LAST_ACTIVE:
return (LRESULT)(HWND)_last_foreground_wnd; return (LRESULT)(HWND)_last_foreground_wnd;