C# 2005 : How do I Disable icon in Alt+Tab list

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CyberSoftHari
    Recognized Expert Contributor
    • Sep 2007
    • 488

    C# 2005 : How do I Disable icon in Alt+Tab list

    I did below and it is not showing in task bar but when I press Alt + Tab then it is showing in that list. How to disable there.
    Code:
    ShowInTaskbar = false;
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    if you .Hide() your window (remember to provide a way to show it again) it will not show up in alt+tab.

    I think the other alternative is to use some win32_api

    Comment

    • CyberSoftHari
      Recognized Expert Contributor
      • Sep 2007
      • 488

      #3
      Thanks, and i got the solution using user32.dll like

      [CODE=cpp]
      'Decleration part
      #region Remove from Alt Tab
      [DllImport("user 32.dll")]
      public static extern int SetWindowLong(I ntPtr window, int index, int value);
      [DllImport("user 32.dll")]
      public static extern int GetWindowLong(I ntPtr window, int index);
      const int GWL_EXSTYLE = -20;
      const int WS_EX_TOOLWINDO W = 0x00000080;
      const int WS_EX_APPWINDOW = 0x00040000;
      #endregion[/CODE]

      calling after InitializeCompo nent, or form load events
      [CODE=cpp]
      int windowStyle = GetWindowLong(t his.Handle, GWL_EXSTYLE);
      SetWindowLong(t his.Handle, GWL_EXSTYLE, windowStyle | TOOLWINDOW);[/CODE]

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Does that cause any changes to your forms layout or borderstyle?

        Comment

        • CyberSoftHari
          Recognized Expert Contributor
          • Sep 2007
          • 488

          #5
          Originally posted by Plater
          Does that cause any changes to your forms layout or borderstyle?
          No, everything usual.

          Comment

          Working...