How to create your own Windows XP Keyboard Mapping? - windows-xp

My father has found a Russian language keyboard mapping that he really likes here. However, it is non-standard and therefore is not one that appears in the Languages (Control Panel->Regional and Language Options->Languages->Details->Text Services And Input Languages->Add) dropdown for keyboard layout selection. To my understanding, it should be a simple task to create a new mapping - perhaps editing an XML file and a reboot. Does anyone know how to do this?
Barring that, how would I go about writing a program to emulate this? It seems like it would have to run in the system tray (I can figure that out), have a hook intercepting incoming keyboard input (no idea how to do this), convert it off a configuration file, and send it to whatever application and text window has current focus (again, no idea). With any luck this should not be too hard.
Any advice?

There's this utility from Microsoft
The Microsoft Keyboard Layout Creator
(MSKLC) extends the international
functionality of Windows 2000, Windows
XP, Windows Server 2003,and Windows
Vistas systems by allowing users to:
Create new keyboard layouts from scratch
Base a new layout on an existing one
Modify an existing keyboard layout and build a new layout from it
Multilingual input locales within edit control fields.
Build keyboard layout DLLs for x86, x64, and IA64 platforms.
Package the resulting keyboard layouts for subsequent delivery and installation.

Try AutoHotKey (http://www.autohotkey.com/) i use it to get emacs keybindings in normal text editors, i'm sure it could tackle this too.
edit: the bit you're looking for is in the quickstart here: http://www.autohotkey.com/docs/Tutorial.htm#Send

Related

Keyboard Filter Driver. Scan Code -> VK_??? (OEM Specific)

Preface (Imaginary. So someone does not ask 'What are you trying to do?):
I have a Win32 C++ application.
This application wants to know when the user wants to open the start menu via Ctrl+Esc
Of course, Ctrl+Esc is fired from the operating system so the application never see's it.
I have looked at Windows Virtual Keys.
I see that there are plenty of OEM specific VK's
(0x92-0x96,0xE0,0xE9-0xF5,..)
So my thought was:
Keyboard Filter Driver.
When my application has the focus it tells the Keyboard Filter Driver.
When my driver sees the Ctrl is down and an Esc down occurs (And my application has focus):
-- Swallow the Esc and replace it with a scan code that will produce say a VK_0x92 (OEM Specific).
Since I have swallowed the Esc the operating system will never see Ctr+Esc
My application will then see the VK_0x92 and know the user wants to open the start menu and perform some action.
My question is how do I 'muck' the input within my driver (KEYBOARD_INPUT_DATA) in order for a say
VK_0x92 to appear within my application?
Thanks in advance for any pointers.
It is all about the Keyboard Layout.
What I needed to do was not supported by Microsoft Keyboard Layout Creator (MKLC).
See: Keyboard Layout Samples.
I found the samples to be very old and hard to read through. Clearly the US and German keyboard samples are not the most recent.
I wrote a program to create Visual Studio projects for keyboard layouts by pointing to a specific layout (I.e, KBDUS.dll for example). I generate the source code, .vxcproj, ... I then make my modifications and build it.
Installing the layout is another can of worms entirely. I have asked in several places for Microsoft to release the source code for the CustomAction Dll that is contained within the MKLC generated .MSI to no avail.

Checking if control/command key is currently pressed in VS Extensions

In my extension, I would like to check in a certain function, if the control (or command) key is currently pressed. How is that possible? I couldn't find any field that exposes this information.
If you read the below article
https://code.visualstudio.com/docs/extensionAPI/patterns-and-principles
It says
Visual Studio Code has a very rich extensibility model and there are many ways to extend the tool. However, we do not provide direct access to the underlying UI DOM to extension writers. With VS Code, we’re continually trying to optimize use of the underlying web technologies to deliver an always available, highly responsive editor and we will continue to tune our use of the DOM as these technologies and our product evolve. To maintain performance and compatibility, we run extensions in their own host process and prevent direct access to the DOM. VS Code also includes a built-in set of UI components for common scenarios such as IntelliSense, so that these experiences are consistent across programming languages and extensions and extension developers do not need to build their own.
We realize that this approach may initially feel restrictive to extension developers. We’re always looking for ways to improve our extensibility model and expand the capabilities available to extensions. We look forward to hearing your feedback and ideas.
This means your extension code doesn't run the in editor window context at all. And you can't hack into the webview as the extension api doesn't provide it. So you need to open a Feature request with VScode team and ask them to expose either the last keyboard event or atleast the status of Shift, Ctrl and alt keys. Currently they just discard it and throw it away (if no editor is open) else they send it to the monaco editor before checking for any shortcut combination
This does not directly answer your question but maybe helps solving your problem:
Your extension could contribute two different commands: For example first command myextension.runTarget (noDebug=true) and myextension.debugTarget (noDebug=false). In addition your extension can contribute keybindings that bind those two commands to different hotkeys, for instance CTRL + F5 and only F5.
Looks like vscode itself does it the same way (screenshot of keybindings view):
This question might be of use. With this approach you could track a key down event and then if the key code is equal to command (91 or 93 on Safari/Chrome, 224 on Firefox) or control. From there, you could put in your functionality if this returns as true, or however you want to structure it

VB6 form cuts off toolbar at run-time on Windows 7/8/10 but not XP

I have a Visual Basic 6.0 application which has several forms hosting toolbars. One of these forms, as depicted in the image, displays with its toolbar cut off or truncated on the right by the form's right hand edge. There should be a 'Paste' button also displayed.
At design time the form displays correctly. At run time it also displays correctly on Windows XP, but not on 7/8/10. I am using a VMWare VM running XP Professional 32-bit for development. Notable properties include: form is re-sizeable; toolbar does not wrap. I have tried setting the form width manually in the 'Load' event with no effect. Aside from this issue I've had no problems running this Visual Basic 6.0 application on any version of windows. Any help would be greatly appreciated. Thank you.
Why you use Windows XP as environment of development?
You should use always the latest version of Windows (Windows 10) to avoid this problems.
You should never use Windows XP as a development environment because it is too different from Windows versions (Vista and later). It would make sense only if you use the Classic theme in all versions of Windows, otherwise you will find many differences because system object measurements vary from theme to theme. Only the Classic theme is constants on all Windows versions.
My solution example: on my applications I use save/load routines to manage the form size and position (I use a simply user INI file). So, when the user change them will be saved on INI file, the next session the same size e position will be loaded again.
However, this solve the problem with resizable form, for fixed forms don't.
Finally, i suggest you to create a Windows 10 (VMWare or VirtualBox), install all VB6 environment, and use this to develop.
But, of course, if your host system is already Windowx 10, then use this directly.

Is there a way to set my windows to a certain configuration and then swap between configurations with a shortcut?

While doing web development, I have a few modes that I work in, and each mode has an optimal arrangement of my windows. For example, when coding, I like to have my windows arranged one way (Visual Studio full screen, etc) and when testing in the browser, I like to have my windows totally different (browser, inspect window, source code window etc). I can't simply Alt + Tab between windows because I am working with multiple windows in each mode.
Is there some way to have a keyboard shortcut that arranges all my windows into configuration A, then another keyboard shortcut that arranges all my windows back to configuration B?
The answer is no. The best solution I got was to optimize the browser windows myself and save them in local storage for later use.
I used Google Chrome extension for this https://chrome.google.com/webstore/detail/multi-layout-manager/ijpiffheldgmdkbaohoilabdnmeinand?hl=en
I had to use web sockets for communication between browser windows and tabs.

desktop icon functionality in a window

My wife complains that I have too many icons on the Windows XP-Pro desktop.
I like to be able to quickly drop a file onto the icon for application I want to have open it. And I like to follow a link to open often-used deeply nested folders rather than navigate there. Thus, I have over 100 icons on the desktop.
(We share the same user account because we switch back and forth so often and because we both need to access the same e-mail, so separate accounts isn't the answer.)
I'd like to write a program which would have similar functionality to the Windows desktop. Then I could open that window to do the drag and drop work, but, when minimized, would leave the desktop display sparsely populated for my wife. As an added bonus, I could implement better organization of the icons than the desktop allows.
This is similar to what an Explorer window does, with the key exception that the desktop allows you to do some arrangement of icons. (For instance, program icons on the left (with the most used ones near the top), folders at the top, data files on the right.)
How do I go about getting an icon to display in a Windows Form (or on an appropriate control on the form)? (For instance, if I drop in a link to Notepad or a link to a file folder.)
How do I take the same action that the desktop does if the icon is double clicked? (For instance, if a link to a folder is double clicked.)
How do I take the same action that the desktop does if the icon has something dragged onto it? (For instance, a text file is dragged onto the Notepad icon.)
I'm using Visual Studio and C#.NET for programming.
I know how to do basic drag and drop.
I do not know:
A. what controls to use on the form to display the icons
B. how to find the icon
C. what commands are built by the desktop under various situations (so I can emulate the functionality)
I apologize that this is a multi-part question, but it was hard to break apart without explaining the whole story again.
This is a big question, but I'll give you some quick thoughts to get things moving in the right direction. WinForms exposes the functionality needed to make this happen, it's just a matter of wiring everything up the way you want it.
The key piece that you will want to look into is Drag/Drop, which is very well supported by WinForms. If you implement your icons as ImageBoxes you can set the AllowDrop property on the program icons and then handle the DragDrop event and have it call an overload of System.Diagnostics.Process() to start the application with the dropped filename as an argument.
As far as finding icons, most programs have their icon included as a resource in their .EXE file or in a related .DLL.
Regarding question C, the underlying question is what behaviors of the desktop would you like to have in your program? Explorer.exe is a massive application that does far more than what you need or what you will need or want to implement. Once you decide what functionality you want, play around with the IntelliSense list of events for the form and imagebox controls. You'll find that a lot of behavior is given to you for free in the Windows common controls, and additional behavior is fairly easy to add by handling the appropriate events.
Why dont you just use a Virtual Desktop??
Try http://virtuawin.sourceforge.net/
You will skip a lot of coding.
Right from their page:
"VirtuaWin is a virtual desktop manager for the Windows operating system (Win9x/ME/NT/Win2K/XP/Win2003/Vista). A virtual desktop manager lets you organize applications over several virtual desktops (also called 'workspaces'). Virtual desktops are very common in Unix/Linux, and once you get accustomed to using them, they become an essential part of a productive workflow."