473,804 Members | 2,277 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=Min imize 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 6300
When you want to activate the other application, try using the following

--------------------------
Microsoft.Visua lBasic.AppActiv ate("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******** ********@TK2MSF TNGP10.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=Min imize 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.Visua lBasic.AppActiv ate("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******** ********@TK2MSF TNGP10.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=Min imize 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*********@ho tmail.com> wrote in message
news:eV******** ******@TK2MSFTN GP10.phx.gbl...
When you want to activate the other application, try using the following

--------------------------
Microsoft.Visua lBasic.AppActiv ate("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******** ********@TK2MSF TNGP10.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=Min imize 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%******** ********@TK2MSF TNGP11.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*********@ho tmail.com> wrote in message
news:eV******** ******@TK2MSFTN GP10.phx.gbl...
When you want to activate the other application, try using the following

--------------------------
Microsoft.Visua lBasic.AppActiv ate("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******** ********@TK2MSF TNGP10.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=Min imize 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
2493
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. Unfortunately the window is showing up in the little window that is displayed when user uses Alt-Tab to switch applications. How do I make this application not show up in the Alt-Tab window? Thanks.
3
6729
by: meska | last post by:
Is there a way in c# to hide program , that it would show in alt+tab ?
3
2343
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
13853
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 display so doing this from a keyboard is not an option. Is there any way I can instantiate the built in ALT-TAB window or is there any way I can generate the ALT-TAB event/message progammatically. Thanks for any help. Chris
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 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:
9
6640
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 menu. As it is today, my application will show an icon for each window visible in the running application. I only want one icon.
5
6514
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 kh
10
8588
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
2577
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 Private Sub Form_Unload(Cancel As Integer) UnhookKeyboard
0
9714
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10599
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9173
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6863
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5531
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3832
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.