Results 1 to 3 of 3

Thread: How can I prevent "Show Desktop" or "Windows Key+M" from minimizing my program?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    2

    How can I prevent "Show Desktop" or "Windows Key+M" from minimizing my program?

    hi,

    i don't want my program to be on "TopMost" but i also don't want it to minimize. Never.

    even if i disable the minimize feature, the program can still be minimized by clicking on the "show desktop" icon or pressing Windows Key+M. I'd like to prevent that. Can someone tell me a possible way to do it?

    and btw, the show desktop doesn't trigger the "resize" or "changesize" events.

    Thanks,

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How can I prevent "Show Desktop" or "Windows Key+M" from minimizing my program?

    Well to prevent minimising by Win+M you can do this:
    Code:
    protected override void WndProc (ref Message m)
    {
        const int WM_SIZE = 5;
    
        if (m.Msg == WM_SIZE)
        {
            this.WindowState = FormWindowState.Normal;
        }
    
        base.WndProc(ref m);
    }
    That doesn't prevent complete hiding by Win+D (same as the Show Desktop icon). I'm still trying to figure out how you'd do that.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    2

    Re: How can I prevent "Show Desktop" or "Windows Key+M" from minimizing my program?

    oh, i must've made a mistake in my original post. i use a thinkpad, which doesn't have the windows key, so i thought windows+m was actually equal to "show desktop". i already know how to prevent minimization. but i'm really trying to find a way to prevent "show desktop" from minimizing/hiding my application. no success so far.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width