Problems with the properties OSK.EXE (On Screen KeyBoard) +POWERSHELL +REGEDIT - windows

as the title indicates I need help with the on-screen keyboard properties.
I have to configure a script, which I will deploy through SCCM in 30 terminals, and I need to make the keyboard go on screen as soon as I start the pc.
I have already solved this by adding this key to the registry
HKLM\Software\Microsoft\Windows\CurrentVersion\Run Clavier_Visuel = "C:\Windows\System32\osk.exe"
The problem is that I can't find a place to set the parameters of the keyboard: Remove the X to close it, display the PAD number, set the language to French and make it fit the screen.
This can be done manually, but that's not the goal.
Another point is that different users will be logged into the computers, so I can't set the condition to single user, but it should be general for all.
If you can help me it would be great, since I have not found anything useful so far, a greeting!

Related

Produce typing lag on purpose

I have to use USB barcode scanner in application running on remote desktop. This scanner is being recognised by Windows as keyboard. When I try to scan barcode however, every 3th or 4th character is being changed to another one. When I type numbers by hand, they are being correctly written. The question is: is there any way to programmatically produce "lag" on keyboard globally? I would like to create for example a half second gap between keyboard input events and a result on the screen. Some time ago I worked with Windows hooks, and I was able to change keyboard input globally, but I remember I had problems with delaying it. Is there any other way?
you can make an autohotkey script to listen to a keyboard input, wait and then press the same keyboard button.
once you have intalled AHK(autohotkey) , you can do a AHK script whit the intructions that are in the ahk documentation.
Right-Click on your desktop.
Find "New" in the menu.
Click "AutoHotkey Script" inside the "New" menu.
Give the script a new name. Note: It must end with a .ahk extension. Ex. MyScript.ahk
Find the newly created file on your desktop and Right-Click it.
Click "Edit Script".
A window should have popped up, probably Notepad. If so, SUCCESS!
i::
sleep, 500 ;
Send, i
Return
(you can change the "i" for other keyboard keys).
a function would reduce the amount of code that you use, but i don't know how to do it in a AHK script

SHGetPropertyStoreForWindow - How to set properties on existing System.AppUserModel.ID

So I split my window from the main tab group via IPropertyStore via SHGetPropertyStoreForWindow like so:
IPropertyStore_SetValue(pps, PKEY_AppUserModel_ID.address(), 'Contoso.Scratch');
pps->Commit();
Then the user later decides he wants to rename it so with my feature he does:
IPropertyStore_SetValue(pps, PKEY_AppUserModel_RelaunchCommand, customLaunchPath);
IPropertyStore_SetValue(pps, PKEY_AppUserModel_RelaunchDisplayNameResource, 'my first name');
pps->Commit();
This works successfully for the first time. But if he wants to change just the RelaunchCommand and RelaunchDisplayNameResource again it won't work unless I change the ID as well.
I gave RelaunchCommand and RelaunchDisplayNameResource as exmple here, in my real case scenario the user ALSO wants to change the icon but the same issue, it works a first time per ID. Anyway to run multiple times without having to change ID every time?
Thanks
PS:
The other big reason for this solution, is that one of my windows already has a System.AppUserModel.ID and is already pinned. I want to just change the icon/relaunchCommand/etc, if i change the System.AppUserModel.ID then it will effectively unpin it. :(
The solution to this topic is the workaround I am using:
Detecting Application Pin State
Before setting property I test if it's pinned by looking in folders of:
%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\ImplicitAppShortcuts
%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
And I do a IPropertyStore::getValue on all the shortcuts, if it matches my AppUserModelID, then I change the icon, label, etc on that, which right away updates it in the taskbar.
This works but I'll leave this solution unaccepted as it's not documented so probably not the right way to go about it.
If the AppUserModel.ID is not found among the shortcuts, the i just to IPropertyStore::setValue on the windows of my application (I have to do on each window, i cant find a way to do it across the whole application)

Can you remap keys of a specific keyboard?

I've got two keyboards attached to my computer. A normal full-size keyboard and a numeric keypad. I want to "remap" the keys on the numeric keypad, but leave the full keyboard alone. So, when the user presses "5" on the keypad it would get remapped to the "Media Play" key, but if the same "5" was pressed on the keypad of the full keyboard, I'd get a "5". In essence, I want to turn that seperate numeric keypad into a media control device.
Unfortunately I'm not sure how to make this work. There is a "Raw Input" feature of Windows which allows to distinguish between keyboards, but that only allows to read the keys - not remap them. There are keyboard hooks (low level and high level) which can remap the keystrokes, but they don't distinguish between keyboards.
Can I make a combination of the two methods work? For that I'd have to be sure that the raw input message is processed before the keyboard hook kicks in. Is that so?
Also, I've read that Windows for some reason does not allow to use Raw Input and Keyboard Hooks in the same process. I could work around that by making 2 different processes, but that becomes more fragile because of communication latency (keyboard hooks have very limited time in which they must complete their work).
Is this doable at all?
In the end it turned out I needed a custom keyboard driver to accomplish this. Fortunately I found one ready for taking - Interception. The app is ready and works perfectly. :)
I wanted to expand on the answer by Vilx as I've revisited this post several times, and I've only just managed to remap my second keyboard so the keys act uniquely. This is done using Interception and Intercept together, and it's the only working solution that I've managed to get working so far.
I'm also looking into using a raspberry pi to remap a second keyboard. Although early days, I think it it's achievable: Plug keyboard into Pi, plug Pi into PC and write script to turn input keycodes into customized output commands / keycodes. Will update when I have tested.
My working Intercept solution is completely based on a Github tutorial by TaranVH which details the process the best so far. I've copied his solution below with some amends of my own.
DOWNLOADING INTERCEPTION:
Navigate to this page: https://github.com/oblitum/Interception
Click on "download the latest release."
Click on Interception.zip to download it.
Unzip the file to a folder on your computer - I recommend using a folder location that won't ever move. I put my Interception folder into C:\Program Files\ and I'll be using this location in my examples.
INSTALLING INTERCEPTION:
Open a terminal as administrator and type cd "C:\Program Files\Interception\command line installer"
Hit Enter
Now, type in the following line of text exactly as shown:
install-interception.exe /install
Hit Enter
Once the program installs sucessfully, you still must restart your computer in order to complete the installation.
(If you ever want to UNinstall interception, watch this): https://www.youtube.com/watch?v=Hn18vv--sFY
INSTALLING INTERCEPT - (This is different from intercepTION!)
Download Kamaz's intercept.exe zip from one of these locations:
http://octopup.org/img/code/interception/intercept.zip
https://github.com/TaranVH/2nd-keyboard/blob/master/Intercept/intercept.exe
Unzip it if it's a .zip file and locate intercept.exe
To keep these files all in one place, I moved intercept.exe into C:\Program Files\Interception\
Reboot your system.
SETTING UP INTERCEPT
Plug in your second keyboard and ensure that it is working normally.
Go to where you saved intercept.exe and double click to open.
Intercept will open as a terminal, and from there you should have basic instructions to start remapping your keyboard.
Type a to add a key.
On the SECONDARY keyboard, press the Q key once. (this is the key that you are remapping)
You will be prompted with Enter combo for this trigger, end with ESC.
Carefully execute the following keystrokes (it doesn't matter which keyboard): Win + E (That is: hold down the windows key while pressing the letter E. I've found you need to do this quickly and accurately, if you hold down too long, extra keypresses are added)
When I did it, this was shown in the terminal: [Left Windows]↓ [E]↓ [E]↑ [Left Windows]↑
Press Esc and you will be prompted to label the script
I labelled mine Q->WinE so I knew what it was doing.
Press Enter to accept the label
Press S to save the filter, or C to cancel if you made a mistake.
Add more filters or close the terminal.
USING INTERCEPT
Now you've set up a custom key command, you need to apply the filter to use it.
Open up intercept.exe
Press Y to apply the filters, you will get confirmation that the filters have been activated.
Now, when you press Q on your second keyboard, Intercept will change the command to Win+E which will open File Explorer.
Caveat:
Please read TaranVH githubs page on this https://github.com/TaranVH/2nd-keyboard/tree/master/Intercept as it provides some further details and troubleshooting.
Please take care to follow the instructions very exactly as there's very little error handling in this process
In this article http://vlaurie.com/computers2/Articles/remap-keyboard.htm is explained how to remap keys of a keyboard. Hope that helps.

Programmatically Changing XP Appearance Settings

I am trying to silently apply very specific appearance settings for a single user with poor eyesight on an XP machine.
I can alter the settings by using the appearance tab of the display settings dialog and clicking apply/ok. Doing this works however the user cannot see well enough to change her settings back to how she likes them each time she logs on.
Just changing the registry keys does not make the desired changes until the user logs off and then on again. For reasons that would take too long to explain, I cannot simply get the user to log off and then on again. I need the settings to be applied immediately upon login.
So! I either need to force windows to apply the display settings, a process which seems to be associated with the 'Please Wait' dialog, screenshot included OR I need to programmatically change the appearance settings individually (which includes altering 'Advanced' font-size settings).
Many thanks.
Please Wait Example http://www.dur.ac.uk/alexander.holmes2/b/pleasewait.jpg
Does this user have his/her own windows User? (his/her own account on XP). It should keep settings for you if you have them as a separate user from whoever else likes the larger DPI. Just create a user.

Update desktop "show window contents while dragging" setting programatically

One of my programs seems to be changing the Display Properties > Appearance > Effects > Show window contents while dragging setting to off every few hours.
I'm not sure exactly which program, or when it happens. I have a number of programs that seem like likely culprits - wallpaper rotators, software for multiple monitors, multiple virual desktops and switching, and a few others.
I am just thinking to create a little batch script to run periodically and set the setting back to on.
Does anyone know how to do this in windows? I'm using xp pro sp3.
Thanks!
The best option is to do this programmatically using the supported API. i haven't tested this, but it should do the trick:
SystemParametersInfo(SPI_SETDRAGFULLWINDOWS,
TRUE,
NULL,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE)
You can use SPI_GETDRAGFULLWINDOWS to see if the the bit has been flipped to avoid unnecessarily triggering a WM_SETTINGCHANGE.
You can use RegMon to find the program that keeps changing your settings. Maybe that's a better start than hacking around it.
There is a simple and effective solution to this problem. In Notepad type the following lines :
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Desktop] "DragFullWindows"="1"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DragFullWindows] "CheckedValue"=dword:00000001 "UncheckedValue"=dword:00000001
Save the file as "Show Window Contents.reg" Double clicking this file and restarting will cure the problem permanently. Post a message if you find this useful.
Aravind Banerjee
It seems the registry setting which controls that preference is HKCU\Control Panel\Desktop\DragFullWindows. You can read more about it here. However, trying it on my own computer does not register the change right away, so a batch script won't do it. You'll probably have to write a program to manipulate it using SystemParametersInfo(). You can pass it the SPI_SETDRAGFULLWINDOWS parameter. Here's a page explaining it more. Here's a page showing how to call it, albeit not for the same parameter.
I suspect it's kept in the registry - maybe [HKEY_CURRENT_USER\Control Panel\Desktop] - "DragFullWindows"?
It would be easy to flip the registry setting back to "1" every hour or so with a batch file.

Resources