Thread: System Menu

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    183

    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

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    I don't know, but perhaps you can do some perverted hack using GetSystemMenu() and ModifyMenu()
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    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);
      }
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    183
    Haven't been on in a while, but yeah that sounds about right.
    Cheers Ken.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 06-13-2005, 09:03 AM
  2. Replies: 3
    Last Post: 06-13-2005, 07:28 AM
  3. pop up menu problem
    By bigtamscot in forum Windows Programming
    Replies: 5
    Last Post: 06-10-2003, 01:46 AM
  4. Menu stuff
    By Shadow in forum C Programming
    Replies: 10
    Last Post: 04-28-2002, 09:05 AM
  5. quick question about C Dos text menu pgm i was doing
    By Shadow in forum C Programming
    Replies: 2
    Last Post: 09-16-2001, 10:26 AM