Program icons in the ALT+TAB menu

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Larsen

    Program icons in the ALT+TAB menu

    Hi,
    I have asked this question before, but did not get anything useful from it -
    so sorry that i am asking again !!

    How do i prevent an application from appears more than once in the ALT+TAB
    menu.

    As it is today, my application will show an icon for each window visible in
    the running application. I only want one icon.

    And please - i'm not talking about the taskbar and/or property
    ShowInTaskbar. I already know this and it does not solve my
    problem/question.

    Thank you in advance.
    Peter



  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Program icons in the ALT+TAB menu

    Peter,

    Are you saying you want more than one application instance to run, but
    just one icon in the alt-tab list?


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Peter Larsen" <tjanne39@gmail .com> wrote in message
    news:%23YtgcbEG GHA.1088@tk2msf tngp13.phx.gbl. ..[color=blue]
    > Hi,
    > I have asked this question before, but did not get anything useful from
    > it - so sorry that i am asking again !!
    >
    > How do i prevent an application from appears more than once in the ALT+TAB
    > menu.
    >
    > As it is today, my application will show an icon for each window visible
    > in
    > the running application. I only want one icon.
    >
    > And please - i'm not talking about the taskbar and/or property
    > ShowInTaskbar. I already know this and it does not solve my
    > problem/question.
    >
    > Thank you in advance.
    > Peter
    >
    >
    >[/color]


    Comment

    • Ignacio Machin \( .NET/ C# MVP \)

      #3
      Re: Program icons in the ALT+TAB menu

      Hi,

      "Peter Larsen" <tjanne39@gmail .com> wrote in message
      news:%23YtgcbEG GHA.1088@tk2msf tngp13.phx.gbl. ..[color=blue]
      > Hi,
      > I have asked this question before, but did not get anything useful from
      > it - so sorry that i am asking again !![/color]

      This is the first time I see it in this NG !
      [color=blue]
      > How do i prevent an application from appears more than once in the ALT+TAB
      > menu.
      >
      > As it is today, my application will show an icon for each window visible
      > in
      > the running application. I only want one icon.
      >[/color]

      This is what I would do:
      1- Detect if another instance of my app is running ( posted many times
      here )
      2- If an instance is running hide the new instance from the ALT+TAB ( code
      posted below).

      The problem may be in hiding it, the code use Set/GetWindowLong which IIRC
      will affect ALL the instances of that particular window , please somebody
      correct me if I'm wrong.

      Anyway, you could just try it


      Now, I do hope you have a strong reason for doing this, I would be very
      surprise knowing I have 10 instances open of IE and seeing only one in the
      list.


      --
      Ignacio Machin,
      ignacio.machin AT dot.state.fl.us
      Florida Department Of Transportation










      [DllImport("user 32.dll")]
      public static extern int SetWindowLong( IntPtr window, int index, int
      value);
      [DllImport("user 32.dll")]
      public static extern int GetWindowLong( IntPtr window, int index);


      const int GWL_EXSTYLE = -20;
      const int WS_EX_TOOLWINDO W = 0x00000080;
      const int WS_EX_APPWINDOW = 0x00040000;

      private System.Windows. Forms.NotifyIco n notifyIcon1;


      // I use two icons depending of the status of the app
      normalIcon = new Icon(this.GetTy pe(),"Normal.ic o");
      alertIcon = new Icon(this.GetTy pe(),"Alert.ico ");
      notifyIcon1.Ico n = normalIcon;

      this.WindowStat e = System.Windows. Forms.FormWindo wState.Minimize d;
      this.Visible = false;
      this.ShowInTask bar = false;
      iconTimer.Start ();

      //Make it gone frmo the ALT+TAB
      int windowStyle = GetWindowLong(H andle, GWL_EXSTYLE);
      SetWindowLong(H andle, GWL_EXSTYLE, windowStyle | WS_EX_TOOLWINDO W);


      Comment

      • Brett Wickard

        #4
        Re: Program icons in the ALT+TAB menu

        I think he's saying that he has one application running only once with
        numerous windows open (that are visible in the taskbar) --- so when the user
        hits alt-tab, the application shows up a bunch of times - once for each
        window open that is visible in the task bar. This is the default behavior
        of other windows apps, so I think he wants to know if there is a way to
        override that default behavior.

        "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
        message news:%23W%23I6e EGGHA.1032@TK2M SFTNGP11.phx.gb l...[color=blue]
        > Peter,
        >
        > Are you saying you want more than one application instance to run, but
        > just one icon in the alt-tab list?
        >
        >
        > --
        > - Nicholas Paldino [.NET/C# MVP]
        > - mvp@spam.guard. caspershouse.co m
        >
        > "Peter Larsen" <tjanne39@gmail .com> wrote in message
        > news:%23YtgcbEG GHA.1088@tk2msf tngp13.phx.gbl. ..[color=green]
        >> Hi,
        >> I have asked this question before, but did not get anything useful from
        >> it - so sorry that i am asking again !!
        >>
        >> How do i prevent an application from appears more than once in the
        >> ALT+TAB
        >> menu.
        >>
        >> As it is today, my application will show an icon for each window visible
        >> in
        >> the running application. I only want one icon.
        >>
        >> And please - i'm not talking about the taskbar and/or property
        >> ShowInTaskbar. I already know this and it does not solve my
        >> problem/question.
        >>
        >> Thank you in advance.
        >> Peter
        >>
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • Peter Larsen

          #5
          Re: Program icons in the ALT+TAB menu

          No - one application with multiple visible forms - but only apearing once in
          the ALT+TAB menu !

          Did i really say so ??

          /Peter :-)

          "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote in
          message news:%23W%23I6e EGGHA.1032@TK2M SFTNGP11.phx.gb l...[color=blue]
          > Peter,
          >
          > Are you saying you want more than one application instance to run, but
          > just one icon in the alt-tab list?
          >
          >
          > --[/color]


          Comment

          • Peter Larsen

            #6
            Re: Program icons in the ALT+TAB menu

            You are talking about one application started more than once - this is not
            my question.
            I'm talking about ONE application with more than one window visible.

            /Peter :-)

            "Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
            in message news:OpzYilEGGH A.1396@TK2MSFTN GP11.phx.gbl...[color=blue]
            > Hi,
            >
            > "Peter Larsen" <tjanne39@gmail .com> wrote in message
            > news:%23YtgcbEG GHA.1088@tk2msf tngp13.phx.gbl. ..[color=green]
            >> Hi,
            >> I have asked this question before, but did not get anything useful from
            >> it - so sorry that i am asking again !![/color]
            >
            > This is the first time I see it in this NG !
            >[color=green]
            >> How do i prevent an application from appears more than once in the
            >> ALT+TAB
            >> menu.
            >>
            >> As it is today, my application will show an icon for each window visible
            >> in
            >> the running application. I only want one icon.
            >>[/color]
            >
            > This is what I would do:
            > 1- Detect if another instance of my app is running ( posted many times
            > here )
            > 2- If an instance is running hide the new instance from the ALT+TAB ( code
            > posted below).
            >
            > The problem may be in hiding it, the code use Set/GetWindowLong which IIRC
            > will affect ALL the instances of that particular window , please somebody
            > correct me if I'm wrong.
            >
            > Anyway, you could just try it
            >
            >
            > Now, I do hope you have a strong reason for doing this, I would be very
            > surprise knowing I have 10 instances open of IE and seeing only one in the
            > list.
            >
            >
            > --
            > Ignacio Machin,
            > ignacio.machin AT dot.state.fl.us
            > Florida Department Of Transportation
            >
            >
            >
            >
            >
            >
            >
            >
            >
            >
            > [DllImport("user 32.dll")]
            > public static extern int SetWindowLong( IntPtr window, int index, int
            > value);
            > [DllImport("user 32.dll")]
            > public static extern int GetWindowLong( IntPtr window, int index);
            >
            >
            > const int GWL_EXSTYLE = -20;
            > const int WS_EX_TOOLWINDO W = 0x00000080;
            > const int WS_EX_APPWINDOW = 0x00040000;
            >
            > private System.Windows. Forms.NotifyIco n notifyIcon1;
            >
            >
            > // I use two icons depending of the status of the app
            > normalIcon = new Icon(this.GetTy pe(),"Normal.ic o");
            > alertIcon = new Icon(this.GetTy pe(),"Alert.ico ");
            > notifyIcon1.Ico n = normalIcon;
            >
            > this.WindowStat e = System.Windows. Forms.FormWindo wState.Minimize d;
            > this.Visible = false;
            > this.ShowInTask bar = false;
            > iconTimer.Start ();
            >
            > //Make it gone frmo the ALT+TAB
            > int windowStyle = GetWindowLong(H andle, GWL_EXSTYLE);
            > SetWindowLong(H andle, GWL_EXSTYLE, windowStyle | WS_EX_TOOLWINDO W);
            >[/color]


            Comment

            • Peter Larsen

              #7
              Re: Program icons in the ALT+TAB menu

              Thats right !!

              "Brett Wickard" <brettwickard@n ospam.nospam> wrote in message
              news:OrHwKmEGGH A.1424@TK2MSFTN GP12.phx.gbl...[color=blue]
              >I think he's saying that he has one application running only once with
              >numerous windows open (that are visible in the taskbar) --- so when the
              >user hits alt-tab, the application shows up a bunch of times - once for
              >each window open that is visible in the task bar. This is the default
              >behavior of other windows apps, so I think he wants to know if there is a
              >way to override that default behavior.
              >
              > "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote
              > in message news:%23W%23I6e EGGHA.1032@TK2M SFTNGP11.phx.gb l...[color=green]
              >> Peter,
              >>
              >> Are you saying you want more than one application instance to run, but
              >> just one icon in the alt-tab list?
              >>
              >>
              >> --
              >> - Nicholas Paldino [.NET/C# MVP]
              >> - mvp@spam.guard. caspershouse.co m
              >>
              >> "Peter Larsen" <tjanne39@gmail .com> wrote in message
              >> news:%23YtgcbEG GHA.1088@tk2msf tngp13.phx.gbl. ..[color=darkred]
              >>> Hi,
              >>> I have asked this question before, but did not get anything useful from
              >>> it - so sorry that i am asking again !!
              >>>
              >>> How do i prevent an application from appears more than once in the
              >>> ALT+TAB
              >>> menu.
              >>>
              >>> As it is today, my application will show an icon for each window visible
              >>> in
              >>> the running application. I only want one icon.
              >>>
              >>> And please - i'm not talking about the taskbar and/or property
              >>> ShowInTaskbar. I already know this and it does not solve my
              >>> problem/question.
              >>>
              >>> Thank you in advance.
              >>> Peter
              >>>
              >>>
              >>>[/color]
              >>
              >>[/color]
              >
              >[/color]


              Comment

              • Michael Bray

                #8
                Re: Program icons in the ALT+TAB menu

                "Peter Larsen" <tjanne39@gmail .com> wrote in
                news:#YtgcbEGGH A.1088@tk2msftn gp13.phx.gbl:
                [color=blue]
                > How do i prevent an application from appears more than once in the
                > ALT+TAB menu.
                >
                >[/color]

                I presume you are opening the windows with Show(). When you call Show,
                pass the owning form as a parameter:

                public partial class Form1 : Form
                {
                public Form1()
                {
                InitializeCompo nent();
                }

                private void button1_Click(o bject sender, EventArgs e)
                {
                // Form2 defined elsewhere
                Form2 f = new Form2();
                f.Show(this);
                }
                }

                This works, but I don't know what other side effects it might have.

                -mdb

                Comment

                • Stoitcho Goutsev \(100\)

                  #9
                  Re: Program icons in the ALT+TAB menu

                  Peter,
                  [color=blue][color=green][color=darkred]
                  >>>> And please - i'm not talking about the taskbar and/or property
                  >>>> ShowInTaskbar. I already know this and it does not solve my
                  >>>> problem/question.[/color][/color][/color]

                  I don't know what other suggestion can be made. The ALT+TAB list shows
                  windows that appear in the task bar. I don't know how you can solve the
                  problem if you don't want to hide your windows from the task bar.



                  --

                  Stoitcho Goutsev (100)




                  "Peter Larsen" <tjanne39@gmail .com> wrote in message
                  news:eRVUw8EGGH A.2608@TK2MSFTN GP10.phx.gbl...[color=blue]
                  > Thats right !!
                  >
                  > "Brett Wickard" <brettwickard@n ospam.nospam> wrote in message
                  > news:OrHwKmEGGH A.1424@TK2MSFTN GP12.phx.gbl...[color=green]
                  >>I think he's saying that he has one application running only once with
                  >>numerous windows open (that are visible in the taskbar) --- so when the
                  >>user hits alt-tab, the application shows up a bunch of times - once for
                  >>each window open that is visible in the task bar. This is the default
                  >>behavior of other windows apps, so I think he wants to know if there is a
                  >>way to override that default behavior.
                  >>
                  >> "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c om> wrote
                  >> in message news:%23W%23I6e EGGHA.1032@TK2M SFTNGP11.phx.gb l...[color=darkred]
                  >>> Peter,
                  >>>
                  >>> Are you saying you want more than one application instance to run,
                  >>> but just one icon in the alt-tab list?
                  >>>
                  >>>
                  >>> --
                  >>> - Nicholas Paldino [.NET/C# MVP]
                  >>> - mvp@spam.guard. caspershouse.co m
                  >>>
                  >>> "Peter Larsen" <tjanne39@gmail .com> wrote in message
                  >>> news:%23YtgcbEG GHA.1088@tk2msf tngp13.phx.gbl. ..
                  >>>> Hi,
                  >>>> I have asked this question before, but did not get anything useful from
                  >>>> it - so sorry that i am asking again !!
                  >>>>
                  >>>> How do i prevent an application from appears more than once in the
                  >>>> ALT+TAB
                  >>>> menu.
                  >>>>
                  >>>> As it is today, my application will show an icon for each window
                  >>>> visible in
                  >>>> the running application. I only want one icon.
                  >>>>
                  >>>> And please - i'm not talking about the taskbar and/or property
                  >>>> ShowInTaskbar. I already know this and it does not solve my
                  >>>> problem/question.
                  >>>>
                  >>>> Thank you in advance.
                  >>>> Peter
                  >>>>
                  >>>>
                  >>>>
                  >>>
                  >>>[/color]
                  >>
                  >>[/color]
                  >
                  >[/color]


                  Comment

                  • Peter Larsen

                    #10
                    Re: Program icons in the ALT+TAB menu

                    Great this works :-)
                    Thanks for your time, Michael, and thanks to you all for participating.

                    /Peter :-)

                    "Michael Bray" <mbray@makeDInt oDot_ctiusaDcom > wrote in message
                    news:Xns974A67C F7967Ambrayctiu sacom@207.46.24 8.16...[color=blue]
                    > "Peter Larsen" <tjanne39@gmail .com> wrote in
                    > news:#YtgcbEGGH A.1088@tk2msftn gp13.phx.gbl:
                    >[color=green]
                    >> How do i prevent an application from appears more than once in the
                    >> ALT+TAB menu.
                    >>
                    >>[/color]
                    >
                    > I presume you are opening the windows with Show(). When you call Show,
                    > pass the owning form as a parameter:
                    >
                    > public partial class Form1 : Form
                    > {
                    > public Form1()
                    > {
                    > InitializeCompo nent();
                    > }
                    >
                    > private void button1_Click(o bject sender, EventArgs e)
                    > {
                    > // Form2 defined elsewhere
                    > Form2 f = new Form2();
                    > f.Show(this);
                    > }
                    > }
                    >
                    > This works, but I don't know what other side effects it might have.
                    >
                    > -mdb[/color]


                    Comment

                    Working...