-
System Menu
Hi all.
When I click on the default icon on the left of my taskbar, a little menu pops up. I think it's called the system menu. Is there a way to prevent the menu from appearing, but without removing the icon.
One method I tried just deleted the icon and the close button. I still want the close button functional.
Cheers :cool:
-
I don't know, but perhaps you can do some perverted hack using GetSystemMenu() and ModifyMenu() :)
-
Handle the WM_NCHITTEST message and return HTCAPTION(if you want to still be able to move/drag the window by that part of the caption) or HTNOWHERE if you don't want any action for the area covered by the small icon. You should check the existing window styles so you can accurately calculate the exact dimensions of the corner of the window occupied by the small icon. Something like:
Code:
case WM_NCHITTEST:
{
RECT rc;
GetWindowRect(hwnd,&rc);
int mouse_x=LOWORD(lParam);
int mouse_y=HIWORD(lParam);
static const int small_icon_wd=GetSystemMetrics(SM_CXSIZE);
static const int small_icon_ht=GetSystemMetrics(SM_CYCAPTION)+
GetSystemMetrics(SM_CYEDGE);
if (mouse_x<=(rc.left+small_icon_wd) && mouse_y<=(rc.top+small_icon_ht))
{
return HTCAPTION;
}
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
-
Haven't been on in a while, but yeah that sounds about right.
Cheers Ken.