473,503 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programmatic Alt+Tab

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 back to my
application. That sounds redundant, but what I've found is that if I
minimize my app, it goes to the very end of the Alt+Tab list instead of
being the next in line.
Related Ramblings:
Oddly enough, in VB6, I had this behavior. Setting frm.WindowState =
vbMinimize would minimize my app but still keep it next in line for Alt+Tab.
The same (equivalent) code in VB.NET places it at the end of the Alt+Tab
list, which is no good for what I'm after.

Now I checked, and if I minimize my app by hand, it also goes to the back of
the order, so I think that the VB.NET WindowState=Minimize command more
correctly mimics user behavior. Nevertheless, it isn't what I'm after. So
I've decided that it's ok if my app doesn't minimize; it just needs to give
focus to the previous window in a way that allows the user to Alt+Tab back
to it with a single Alt+Tab.

Any help is appreciated.
-AJ
Nov 20 '05 #1
4 6273
When you want to activate the other application, try using the following

--------------------------
Microsoft.VisualBasic.AppActivate("Untitled - Notepad")
-----------------------

This should activate the application. Change "Untitled-Notepad" to whatever
the text in the title bar of the application is (You can also use the
Program ID). It should also leave your application next in the Alt+Tab
order.

HTH,

Trev

"Adam J. Schaff" <ju**@maine.rr.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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 back to my
application. That sounds redundant, but what I've found is that if I
minimize my app, it goes to the very end of the Alt+Tab list instead of
being the next in line.
Related Ramblings:
Oddly enough, in VB6, I had this behavior. Setting frm.WindowState =
vbMinimize would minimize my app but still keep it next in line for Alt+Tab. The same (equivalent) code in VB.NET places it at the end of the Alt+Tab
list, which is no good for what I'm after.

Now I checked, and if I minimize my app by hand, it also goes to the back of the order, so I think that the VB.NET WindowState=Minimize command more
correctly mimics user behavior. Nevertheless, it isn't what I'm after. So
I've decided that it's ok if my app doesn't minimize; it just needs to give focus to the previous window in a way that allows the user to Alt+Tab back
to it with a single Alt+Tab.

Any help is appreciated.
-AJ

Nov 20 '05 #2
When you want to activate the other application, try using the following

--------------------------
Microsoft.VisualBasic.AppActivate("Untitled - Notepad")
-----------------------

This should activate the application. Change "Untitled-Notepad" to whatever
the text in the title bar of the application is (You can also use the
Program ID). It should also leave your application next in the Alt+Tab
order.

HTH,

Trev

"Adam J. Schaff" <ju**@maine.rr.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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 back to my
application. That sounds redundant, but what I've found is that if I
minimize my app, it goes to the very end of the Alt+Tab list instead of
being the next in line.
Related Ramblings:
Oddly enough, in VB6, I had this behavior. Setting frm.WindowState =
vbMinimize would minimize my app but still keep it next in line for Alt+Tab. The same (equivalent) code in VB.NET places it at the end of the Alt+Tab
list, which is no good for what I'm after.

Now I checked, and if I minimize my app by hand, it also goes to the back of the order, so I think that the VB.NET WindowState=Minimize command more
correctly mimics user behavior. Nevertheless, it isn't what I'm after. So
I've decided that it's ok if my app doesn't minimize; it just needs to give focus to the previous window in a way that allows the user to Alt+Tab back
to it with a single Alt+Tab.

Any help is appreciated.
-AJ

Nov 20 '05 #3
Hmm, perhaps I should have been more specific. I don't know what application
I want to move to, so I can't use its name. I simply want to switch to
whichever application is next in the tab order. So what I want is behavior
exactly like pressing Alt+Tab once.

"Codemonkey" <hu*********@hotmail.com> wrote in message
news:eV**************@TK2MSFTNGP10.phx.gbl...
When you want to activate the other application, try using the following

--------------------------
Microsoft.VisualBasic.AppActivate("Untitled - Notepad")
-----------------------

This should activate the application. Change "Untitled-Notepad" to whatever the text in the title bar of the application is (You can also use the
Program ID). It should also leave your application next in the Alt+Tab
order.

HTH,

Trev

"Adam J. Schaff" <ju**@maine.rr.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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 back to my application. That sounds redundant, but what I've found is that if I
minimize my app, it goes to the very end of the Alt+Tab list instead of
being the next in line.
Related Ramblings:
Oddly enough, in VB6, I had this behavior. Setting frm.WindowState =
vbMinimize would minimize my app but still keep it next in line for Alt+Tab.
The same (equivalent) code in VB.NET places it at the end of the Alt+Tab
list, which is no good for what I'm after.

Now I checked, and if I minimize my app by hand, it also goes to the back of
the order, so I think that the VB.NET WindowState=Minimize command more
correctly mimics user behavior. Nevertheless, it isn't what I'm after.

So I've decided that it's ok if my app doesn't minimize; it just needs to

give
focus to the previous window in a way that allows the user to Alt+Tab back to it with a single Alt+Tab.

Any help is appreciated.
-AJ


Nov 20 '05 #4
Try the following:

System.Windows.Forms.SendKeys.Send("%{TAB}")

This sends the ALT+Tab combination. I've tried this on WindowsXP and it seem
to work the way it should.

Hope this helps,

Trev.
"Adam J. Schaff" <ju**@maine.rr.com> wrote in message
news:u%****************@TK2MSFTNGP11.phx.gbl...
Hmm, perhaps I should have been more specific. I don't know what application I want to move to, so I can't use its name. I simply want to switch to
whichever application is next in the tab order. So what I want is behavior
exactly like pressing Alt+Tab once.

"Codemonkey" <hu*********@hotmail.com> wrote in message
news:eV**************@TK2MSFTNGP10.phx.gbl...
When you want to activate the other application, try using the following

--------------------------
Microsoft.VisualBasic.AppActivate("Untitled - Notepad")
-----------------------

This should activate the application. Change "Untitled-Notepad" to

whatever
the text in the title bar of the application is (You can also use the
Program ID). It should also leave your application next in the Alt+Tab
order.

HTH,

Trev

"Adam J. Schaff" <ju**@maine.rr.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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 back to my application. That sounds redundant, but what I've found is that if I
minimize my app, it goes to the very end of the Alt+Tab list instead of being the next in line.
Related Ramblings:
Oddly enough, in VB6, I had this behavior. Setting frm.WindowState =
vbMinimize would minimize my app but still keep it next in line for

Alt+Tab.
The same (equivalent) code in VB.NET places it at the end of the Alt+Tab list, which is no good for what I'm after.

Now I checked, and if I minimize my app by hand, it also goes to the back
of
the order, so I think that the VB.NET WindowState=Minimize command more correctly mimics user behavior. Nevertheless, it isn't what I'm after.

So I've decided that it's ok if my app doesn't minimize; it just needs to

give
focus to the previous window in a way that allows the user to Alt+Tab back to it with a single Alt+Tab.

Any help is appreciated.
-AJ



Nov 20 '05 #5

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

Similar topics

3
2470
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
6706
by: meska | last post by:
Is there a way in c# to hide program , that it would show in alt+tab ?
3
2315
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
6
13777
by: Chris Mason | last post by:
I have an application that runs full screen on a system and I would like to be able to (at times) switch another program using an ALT-TAB like interface. However the system only has a touchscreen...
0
326
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...
9
6624
by: Peter Larsen | last post by:
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...
5
6486
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 ...
10
8527
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.
2
2561
by: Swan | last post by:
How can I restrict alt+tab and start menu from keyboard while program executing(VB)?I am posting what I tried-- form.frm Option Explicit Private Sub Form_Load() HookKeyboard End Sub...
0
7202
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
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
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
5578
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,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.