473,396 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

Jan 13 '06 #1
9 6619
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]
- mv*@spam.guard.caspershouse.com

"Peter Larsen" <tj******@gmail.com> wrote in message
news:%2****************@tk2msftngp13.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

Jan 13 '06 #2
Hi,

"Peter Larsen" <tj******@gmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,
I have asked this question before, but did not get anything useful from
it - so sorry that i am asking again !!
This is the first time I see it in this NG !
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.


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("user32.dll")]
public static extern int SetWindowLong( IntPtr window, int index, int
value);
[DllImport("user32.dll")]
public static extern int GetWindowLong( IntPtr window, int index);
const int GWL_EXSTYLE = -20;
const int WS_EX_TOOLWINDOW = 0x00000080;
const int WS_EX_APPWINDOW = 0x00040000;

private System.Windows.Forms.NotifyIcon notifyIcon1;
// I use two icons depending of the status of the app
normalIcon = new Icon(this.GetType(),"Normal.ico");
alertIcon = new Icon(this.GetType(),"Alert.ico");
notifyIcon1.Icon = normalIcon;

this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.Visible = false;
this.ShowInTaskbar = false;
iconTimer.Start();

//Make it gone frmo the ALT+TAB
int windowStyle = GetWindowLong(Handle, GWL_EXSTYLE);
SetWindowLong(Handle, GWL_EXSTYLE, windowStyle | WS_EX_TOOLWINDOW);
Jan 13 '06 #3
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]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2******************@TK2MSFTNGP11.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Peter Larsen" <tj******@gmail.com> wrote in message
news:%2****************@tk2msftngp13.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


Jan 13 '06 #4
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]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2******************@TK2MSFTNGP11.phx.gbl...
Peter,

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

Jan 13 '06 #5
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.machin AT dot.state.fl.us> wrote
in message news:Op**************@TK2MSFTNGP11.phx.gbl...
Hi,

"Peter Larsen" <tj******@gmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,
I have asked this question before, but did not get anything useful from
it - so sorry that i am asking again !!


This is the first time I see it in this NG !
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.


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("user32.dll")]
public static extern int SetWindowLong( IntPtr window, int index, int
value);
[DllImport("user32.dll")]
public static extern int GetWindowLong( IntPtr window, int index);
const int GWL_EXSTYLE = -20;
const int WS_EX_TOOLWINDOW = 0x00000080;
const int WS_EX_APPWINDOW = 0x00040000;

private System.Windows.Forms.NotifyIcon notifyIcon1;
// I use two icons depending of the status of the app
normalIcon = new Icon(this.GetType(),"Normal.ico");
alertIcon = new Icon(this.GetType(),"Alert.ico");
notifyIcon1.Icon = normalIcon;

this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.Visible = false;
this.ShowInTaskbar = false;
iconTimer.Start();

//Make it gone frmo the ALT+TAB
int windowStyle = GetWindowLong(Handle, GWL_EXSTYLE);
SetWindowLong(Handle, GWL_EXSTYLE, windowStyle | WS_EX_TOOLWINDOW);

Jan 13 '06 #6
Thats right !!

"Brett Wickard" <br**********@nospam.nospam> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2******************@TK2MSFTNGP11.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Peter Larsen" <tj******@gmail.com> wrote in message
news:%2****************@tk2msftngp13.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



Jan 13 '06 #7
"Peter Larsen" <tj******@gmail.com> wrote in
news:#Y**************@tk2msftngp13.phx.gbl:
How do i prevent an application from appears more than once in the
ALT+TAB menu.


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()
{
InitializeComponent();
}

private void button1_Click(object 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
Jan 13 '06 #8
Peter,
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.

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" <tj******@gmail.com> wrote in message
news:eR**************@TK2MSFTNGP10.phx.gbl... Thats right !!

"Brett Wickard" <br**********@nospam.nospam> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
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]" <mv*@spam.guard.caspershouse.com> wrote
in message news:%2******************@TK2MSFTNGP11.phx.gbl...
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]
- mv*@spam.guard.caspershouse.com

"Peter Larsen" <tj******@gmail.com> wrote in message
news:%2****************@tk2msftngp13.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




Jan 13 '06 #9
Great this works :-)
Thanks for your time, Michael, and thanks to you all for participating.

/Peter :-)

"Michael Bray" <mbray@makeDIntoDot_ctiusaDcom> wrote in message
news:Xn****************************@207.46.248.16. ..
"Peter Larsen" <tj******@gmail.com> wrote in
news:#Y**************@tk2msftngp13.phx.gbl:
How do i prevent an application from appears more than once in the
ALT+TAB menu.


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()
{
InitializeComponent();
}

private void button1_Click(object 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

Jan 13 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dale | last post by:
I'm using the NotifyIcon component on a form within a Windows application that will normally show no interface. NotifyIcon does add an icon as required to the notification area of the Task Bar. ...
3
by: Stefan | last post by:
Hy, i have an app and i must disable this combination: ALT+F4; CTRL+ALT+DEL; CTRL+ESC;ALT+TAB like this: i find something on Internet and i can block ALT+F4 protected override...
1
by: ODB | last post by:
Hi I have a small application with a notifying icon, in the task bar, i have removed the normal icon from the taskbar, but now i need to remove the Alt- Tab menu icon, can you tell me what...
3
by: Nick | last post by:
Hi, I am tring to display a form that does not show in either the task bar or when the user alt-tabs. The form is running full screen and is set to have no border. Nick
0
by: Adam J. Schaff | last post by:
How can I issue an Alt+Tab command from within VB.NET code? Specifically, I am trying to swap to the next application in the Alt+Tab order in a way that is reversible with a single Alt+Tab to get...
5
by: kh | last post by:
My app filters windows messages because of some custom window functionality I have implemented. Does my window receive a message when the user selects Alt-Tab? If so which message? Many thanks ...
0
by: Gary Brown | last post by:
Hi, I have a simple application that displays word-definition pairs at the top of the screen. How do I keep its icon from displaying in the Alt-TAB menu (what is it called?)? It runs with a...
0
by: claudioillanes | last post by:
I'm a beginner with C#. I've got a Forms C# application that has an AxWebBrowser component embedded. While the C# application runs, a user is filling out some text boxes in the AxWebBrowser. If...
10
by: thupham | last post by:
Dear all friend, I want disable Ctl+Alt+Del; Ctrl+Esc; Ctrl+tab, Alt+Tab, Start button, ctrl+Alt+Del, lock all keys on the keyboard. Have you ever do it in C#. Help me. Thanks for all reply.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.