Switch to active window to left/right in taskbar - scripting

I have been using 7+ Taskbar Tweaker for a day and I'm blown away with two features. Mainly because windows alt+tab is not memorising order of open windows in it. There are two commands that I use constantly. 101 - Switch to the window which is located on the left to the active window on the taskbar and Switch to the window which is located on the right to the active window on the taskbar.
So when I do some programming and have to switch between windows fast, I just assign shortcuts for those 2 operations. It's making switching between windows so easy. One key is moving focus left and other to do right.
Is it possible to do this in autohotkeys? It would be so awesome. Because actually I don't need whole program, only this feature. I saw some code for it on web but it's not working in win 7/64. Basically I need script that will assign hotkey for moving focus from active window on taskbar to one to the left or one to the right. Also when it run out of left/right windows it should circle back to starting window(like normal alt tab is doing.)

Aw... yes I think I wrote a script could do just that some years ago, but I'm not sure how exactly I did it.
The real problem here is finding the order of the windows in the takbar.
But I can tell you there is no official api for it and from what I could tell using registry monitoring software, the order isn't stored in the registry.
For now, that's the only thing that comes to my mind:
F1::WinActivateByTbIndex(4) ;activate the fourth window in the task bar with F1
F2::WinActivateByTbIndex(2) ;activate the second window in the task bar with F2
WinActivateByTbIndex(index) {
WinActivate, ahk_class Shell_TrayWnd
ControlSend, MSTaskListWClass1, % "{Tab}{Right " index-1 "}", ahk_class Shell_TrayWnd
Send, {Up}{Enter}
}
But if you have multiple windows behind one taskbar icon, then you will just enable the first one, so that may not be too useful..
Windows also provides the hotkeys Win+1 up to Win+0 Win+2 ... upt to Win+0 as quick shortcuts to enable window 1-10, but it suffers from 2 limitations: It only works for the first 10 windows and you always activate the first window of a stack (just like my hotkeys).

Actually I was reading about this a lot, and the alt + esc and alt+ shift +esc that is native in windows is doing a pretty good job of functionality that I need. It's cycling through open windows, in order that they were open. Only downside is that if you have minimized windows it will select them and they will stay minimized, it will not put them to front. I was tripped by this until I figure it out. One shortcut is for moving left and other right, you just have to open windows in order in which you would like to cycle through.
So.. alt+esc and alt+ shift+esc are working, but they are so hard to press, especially if you want to do that fast. Along came autohotkey, I tested this code and it's working flawlessly.
!w::
sendInput {alt down}{esc}{alt up}
return
!e::
sendInput {alt down}{shift down}{esc}{alt up}{shift up}
return

Related

How to make form appear in all desktops of Windows 10 in VB.Net?

I need to make a form visible even when I switch desktop on Windows 10 (by pressing Ctrl-Windows-Arrow) if possible, without any 2nd party lib
You can create multiple desktops by pressing Windows-Tab and clicking the + on the bottom-right corner.
Normally, a form only appears in the original desktop it was shown, and can be dragged to another desktop, but won't appear in multiples at the same time.
I know it's possible, because the splash forms of some applications do this. (Ex: Word, Excel)
I searched all over the web, but couldn't find a solution.
EDIT: Another app that I know that does this is the Task Manager, when you mark the "Always Show" checkbox.
This may be of some help. You have to dive into the world of AutoHotKey but this will solve your issues I'm pretty sure:
https://superuser.com/questions/950960/pin-applications-to-multiple-desktops-in-windows-10
Set your form's topmost property to true? Have you tried that?

Windows 8 .net focus issue form.activate has different behaviour when running with debugger

I have written a WinForms driver safety application for a windows tablet device that will blank the screen (display a full screen blank topmost window) when it detects that the car is moving at say more that 15km/h (using the tablets GPS).
The software has worked fine under Windows 7 but I'm struggling a bit to get it working under Windows 8. My first challenge is to display the blank screen when the Metro start menu is currently displayed. So if the user has the Metro start menu displayed and the car starts moving > 15 km/h my blank screen should display... I need to steal the focus from the metro interface and display my blank window on the desktop.
To test this I wrote a simple vb.net app in 2010. It had a form with a timer firing every 3 seconds. In the Tick event I had the code:
Beep()
Me.Activate()
When I ran this with the debugger and pressed the windows key to show the Metro Start Menu, it worked... The focus switched back to the desktop (and my window). However, when I ran this without the debugger and did the same thing I could hear the beeps but the focus never switched back to the desktop.
Any ideas why the behaviour would be different? Any ideas on how I replicate the same behaviour I get when the debugger is attached?
I have tried a few things like AppActivate, setting the form TopMost, BringToFront but unfortunately this hasn't worked.
The only half solution I have come up with is to send a windows button keystroke but this has other issues.
Windows specifically tries to prevent applications from stealing the foreground from other apps. See the SetForegroundWindow documentation for commentary on this and the factors that can let an application come to the foreground (all of the methods you are trying essentially come down to a SetForegroundWindow call).
Note that one of the explicit blocking circumstances is "The foreground process is not a Modern Application or the Start Screen."
This works for you when debugging because "The process is being debugged" is one of the cases which explicitly allows foreground privileges.
Because this is a generally user-unfriendly thing to do there isn't a good general purpose way to bypass this behaviour and steal the foreground.
Likewise, normal apps cannot run on top of Modern applications or the start screen.
You may be better off locking the system by calling the LockWorkStation function.

Show Networks Flyout (the "connect-to-network" thingie) without explorer.exe running

Requirements:
Our application replaces the usual windows shell (explorer.exe). This is a product requirement for a closed system that we're supplying.
We oughtta let the user select a wi-fi network and connect to it.
The problem: The wi-fi networks dialog only shows up when explorer.exe is running
What we tried:
Write our own wi-fi manager that uses wlan API. It lists connectible networks and allows the user to connect/disconnect. Problem: too many network types/configuratons that have to be tested, especially when the wheel has already been invented and reinvented all over.
Try and check how is the networks dialog implemented. It appears that it's and undocumented COM interface (IUIRAdioManager). Problem: it's undocumented, so no API
Use an existing network manager, for instance the one that comes with the driver. Problems: it's ugly, not to the product's taste; and it opens too many options for the user, like creating and loading profiles, browsing for files on a file system - these things are unacceptable.
Running explorer.exe just for the purpose of showing the networks dialog and then killing it. Problem: once we run explorer.exe - it pops up metro view and hides our fullscreen application or shows the taskbar.
The latter seems like the preferred solution: no need to reinvent the wheel, it does what's needed. Just gotta make explorer.exe not pop out, keep it quiet in the background.
So, we're down to two options:
How to show the networks flyout dialog without explorer.exe?
How to run explorer.exe without it popping out metro or taskbar above our application?
Your first solution would be incredibly difficult to implement. I am almost certain that the Networks window is dependent on explorer.
However, your second is entirely possible.
To hide the taskbar, you will need to find a window (using FindWindowEx) to find the taskbar (name is Shell_traywnd). This will hide the taskbar and start button. EDIT: Unless you are implementing your own taskbar, you might want to set the taskbar to autohide.
Next you will need to hide all of the metro programs. In a similar fashion as above, find the class named EdgeUiInputWndClass and close it. You should be able to get the process name of it and then kill the process.
Windows key. This is a little more difficult. You will probably need to use a program and delete the key or a keyboard hook (a low level keyboard hook) and just ignore key presses with the same scancode as the windows key. Left Windows is 0x5b and Right is 0x5c (source). Note that this will not block Ctrl+Alt+Del.
Finally, to show the Flyout, you can run %windir%\explorer.exe shell:::{38A98528-6CBF-4CA9-8DC0-B1E1D10F7B1B}
(source).
EDIT2:
You should also be able to hide toast notifications via this
Of course, I don't see why you cannot just use Windows 8/8.1 and put the app in kiosk mode.

Windows 8 tablet - How to prevent explorer from starting desktop app with maximized window?

When I start a desktop application on Windows 8 tablet, Explorer starts it with SW_SHOWMAXIMIZED.
For example, if you start Notepad from command prompt, it opens in normal window size, but if you do that from Explorer, maximized window is opened. I have seen this Explorer behavior only on tablet PC and I guess Explorer is doing that on purpose.
I understand that it may be useful for many application programs, but I want my program to start with normal size unless user explicitly requests Explorer to open it maximized.
Is there a way to stop this for my application? I'm hoping that there is an API or manifest to do that, but I couldn't find any information at MSDN.
Thanks in advance.
See if this helps:
Open any program that is affected with this issue. Note: Make sure that it is the only open window of that program. eg. You can only do this if you have one window of command prompt open.
Adjust the window size and position to your liking.
While holding Ctrl on your keyboard, close the window by clicking (or touching, for tablet) the X in the top-right corner of the window to close it.
Re-open the program. Your window should now open in the way you set it in step 3.

Is there a keyboard shortcut to maximize/minimize the output window in Xcode 4?

I'm currently trying to workaround some apparent shortcomings of cocoa touch application tests in Xcode 4 (see this related question). Since failures of application tests are not highlighted in the editor window like failures of logic tests, I find myself using the mouse to scroll through the output window to see the results of failed tests.
I would prefer to use keyboard commands if possible to quickly look at the results of the tests and then quickly move back to the editor. Are there some keyboard shortcuts in Xcode 4 for maximizing and minimizing the output window?
It looks like Command+Shift+Y opens and closes the debug area, but I don't know of a keyboard shortcut to maximize it.
Here's a nice cheat sheet you can print out with lots of keyboard shortcuts.
I haven't found a direct shortcut, but along with Jose Ibanez shortcut, here are some relevant ones.
Cmd+0 Toggle left pane
Cmd+Alt+0 Toggle right pane
Cmd+Shift+Y Toggle bottom pane