How to change current keyboard layout in powershell? - winapi

I have two languages set in my windows settings - Czech (default) and English (for programming). I want to switch between them in powershell.
I generally work in Czech language, and it is my default language on my PC. So whenever I (re)start any app, it starts with Czech keyboard layout.
But I am programming with English layout. So I always need to tap Alt+Shift when I am starting new programming app - i.e. powershell window.
Is there some way to do this with some command in powershell? Or in C#, possibly through some win32 api call (as I could make myself small cmdlet for this)?
I found this question (and some others), but I didn't understand it(them) much...
I never worked with Win API, so I don't know what exactly is possible and how to work with it...
Does somebody has some cmdlet or little tutorial how to do this?

I found nice and very easy solution! There is WASP project on Codeplex. This project allows to manipulate windows, send keys to them and send clicks to them.
Solution for my problem is to import the WASP module when powershell is starting, then select powershell window (using WASP) and send Alt+Shift keystroke to it (using WASP).
Here is the code to include to the powershell profile.ps1 file in order to change language to the next one:
Import-Module WASP
Select-Window powershell | Send-Keys "%+" # '%' = ALT key, '+' = SHIFT key

Go to the Control Panel, open Regional and Language Options.
Click the Details...
Click Add and Remove to manage the languages you need.
add your language. Click OK to exit.
The keyboard layout is changed, you can switch them via Language Bar.
you can also check this link:
http://krypted.com/commands/powershell-commands/

Related

how do I create a program in windows that can be activated by pressing short cut key instead of clicking?

I need to create a GUI working on windows that can be activated by pressing short cuts.
1. is it possible without setup class?
2. if not possible, just achieve pressing hotkeys and activate my program--how should i code it out--would be enough
thanks (I am using Qt for vs2012 add in to do the GUI)
I put some code up that starts a thread that does this. It is windows specific, but it does the job.
Clipboard Shortcut/Hotkey binding with Qt outside of application
One alternative to all of this, is to go to a shortcut to your program, go to its Properties, and then click on the shortcut area and type your desired shortcut. As long as it doesn't overlap with existing hotkeys that are registered in windows, it should work, without a hidden presence of your app in the system tray or some other background thread.
Hope that helps.
libqxt offers a QxtGlobalShortcut class that does what you want.

How to use AutoIt to click a window dialog in a different language

On Windows 7, when we install an unsigned driver, it will pop-up a Windows security dialog. It is easy to have it be clicked on by AutoIt. Just search the window dialog with the specified window title.
But now, I want to use it on another platform with a different language. The window title will be changed to the local language, not the 'Windows security'.
How can I create the AutoIt script, which can handle the Windows security dialog in different language?
Fix this issue by finding a child handle from the security window class.
Try to use a class on Tittle. Title = [CLASS:notepad]
for more information visit here http://autoitsourcecode.blogspot.com/2013/04/autoit-control-send.html
Use the "AutoIt v3 Window Information" Tool provided by the "AutoIt full installation" and try to get some unique information like a Class name which is occuring in each different language dialog window as descirbed in advanced window descriptions. Then use these to search for the proper security window.
I'd suggest, you use the WinWaitActive("[REGEXPTITLE:Windows Security|Windows Sicherheit]") function with regular expressions for being able to wait for multiple windows with different titles.

how to Create my own shortcut key as Ctrl Alt Del

I need to create my own shortcut key, as in when we press Ctrl + Alt + Delete we get the task manager, likewise i need to click some other 2 keys to execute my program.
How should i do this ?
and also i need to know what language i need to program this?
I am using Windows Vista as my OS.
I think what he means is he wants to be able to create shortcut keys in his application.
If you're using Visual Studio, you can do this through the visual designer in menu options.
Anyways, I hope this article sheds some light onto the situation:
http://support.microsoft.com/kb/839201
You tagged vb, and this article explains it in VB as well as C#.
Good luck.
I think you want to use a hotkey under AutoHotKey to run another program. Once you have an autohotkey script running, you can also add keys to perform actions within that program, set up other keys to launch other programs, etc. See entries under StackOverflow's 'autohotkey' tag and other help pages referred to from those links.
Create a shortcut that performs the Ctrl-Alt-Del action for you
(very useful in environments where OSK is not accessible). Create a shortcut to the following:
C:\Windows\explorer.exe shell:::{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}
Double-click that shortcut to access the Ctrl-Alt-Del screen. Now you can forget about the inception through multiple RDP.

Customizing Windows Right-Click menus with multiple levels

I understand the process needed to customize a right click menu going through the regedit etc. However I need to the ability to go multiple levels such as in applications like WinZip. Here's a picture for clarification of what I need
alt text http://img14.imageshack.us/img14/9658/multiplemenus.jpg
You need to write a Shell Extension; there is a guide for writing one in managed code (C#) here. It will involve doing a bunch of interop and implementing COM interfaces that the windows shell will consume, namely IShellExtInit and IContextMenu.
However, one could argue that writing a Shell Extension in managed code is not advisable; it will force windows explorer to load the CLR, (or any app that uses the standard windows 'Open File' dialog) - native code (C++) would be a better choice for this.

Windows shutdown dialog

Is there a way to bring up the Windows XP shutdown dialog (the one with the three buttons – Suspend, Shutdown, Restart and Hibernate when Shift is pressed) using any language (preferred: C/C++, VB, Haskell, batches)?
I think I can load the msgina.dll in my C++ program, but I dunno what to do next – what function in the dll is used to show the dialog?
Assuming that your language has a way to do basic file I/O and invoke shortcuts on Windows, try this tip from here:
Create a new txt file somewhere on your system, open it and put in this one line:
(new ActiveXObject("Shell.Application")).ShutdownWindows();
Save and close the file. Change the extension to *.js.
You can make a shortcut to that file to make it easy to shut down your system.
I find PowerShell to be more elegant than other Windows scripting options.
(New-Object -Com Shell.Application).ShutdownWindows()

Resources