I want to know whether it is possible to Windows default shortcuts functions.
We know that Ctrl+F is used to search in windows explorer. But I want to use Ctrl+F to trigger my application which will give more advanced options to search.
I want Ctrl+F should open my application within windows explorer only and not in entire computer.
I dont want to alter the any other keys functions except Ctrl+F.
Is it possible ? If yes how ?
Please help.
Finally I have decided to use AHK,
#IfWinActive ahk_class CabinetWClass
^f::
Run "C:\myapp.exe"
return
#IfWinActive ; turn off context sensitivity
Related
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.
I have a very basic VBS script that I plan on using frequently on my Windows 7 machine. Is there any way I can bind it to a keyboard shortcut so I don't have to navigate to it through Explorer obnoxiously.
I realize this question does not directly pertain to programming, or even scripting for that matter, but I could not find a straight answer online or through my own experimentation. I'm sure that there is a simple solution somewhere...
Thank you for taking the time to read, and hopefully respond to my inquiry.
Evin Ugur.
Windows does have built-in support for shell shortcut keys, where a keypress is used to invoke an *.lnk file that launches your VBScript (using either cscript or wscript).
Create a shortcut file, have it invoke your VBScript file directly or run cscript or wscript with the appropriate arguments, then save it and open its Properties sheet and set a keystroke in the "Shortcut key" field (I suggest something like Ctrl+Alt+K).
Like so:
Then, whenever you press Ctrl+Alt+K, regardless of the active application, your script will be invoked.
A more heavy-duty alternative is AutoHotKey: http://www.autohotkey.com/
Just as an FYI.
I tried this and I was not able to register the hotkey when I had the Icon in a costume folder. Even if I added the hotkey, it failed to work.
Once I moved the icon to the "C:\ProgramData\Microsoft\Windows\Start Menu\Programs", the hotkey started to work.
I don't know if this is even possible, but I thought I'd ask anyway.
I know that you can append ,,tabnumber to the end of a
rundll32.exe shell32.dll,Control_RunDLL
command to open a window on a specified tab, but is there a way to open a further window by programmatically selecting a button on that tab?
For example, I'm using
rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,4
to open Windows' Internet Properties window, but is there a way to programmatically to open the LAN Settings window from there, as LAN Settings doesn't seem to have its own process I can call directly.
(I plan to use this with things other than LAN Settings, if there is a solution, such as "Copy settings..." within the "Administrative" tab on the Region and Language window)
There is no general mechanism for this. You are better off doing whatever you need programmatically instead of trying to drive the UI (which changes from version to version). – Raymond Chen
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.
Is it possible to re-assign the Win+L hotkey to another executable/shortcut?
Use-case - I would like to switch off the monitor of my laptop as soon as it is locked. I know of a executable which can lock and turn off the monitor but I do not want to change the way the system is locked (by running the program explicitly or by some other shortcut). It would be best if Win+L can be assigned to this executable.
You need to set the following registry key to completely disable the Windows locking feature:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System] "DisableLockWorkstation"=dword:00000001
And restart the computer.
This works on Win7, Win8 and Win10
The Win+L is a system assigned hotkey and there's no option to disable it. This means there's no way for an application to detect it, unless you use a low-level global keyboard hook (WH_KEYBOARD_LL). This works in XP SP3; haven't tested it in Vista though:
LRESULT CALLBACK LowLevelKeyboardProc(int code, WPARAM wparam, LPARAM lparam) {
KBDLLHOOKSTRUCT& kllhs = *(KBDLLHOOKSTRUCT*)lparam;
if (code == HC_ACTION) {
// Test for an 'L' keypress with either Win key down.
if (wparam == WM_KEYDOWN && kllhs.vkCode == 'L' &&
(GetAsyncKeyState(VK_LWIN) < 0 || GetAsyncKeyState(VK_RWIN) < 0))
{
// Place some code here to do whatever you want.
// ...
// Return non-zero to halt message propagation
// and prevent the Win+L hotkey from getting activated.
return 1;
}
}
return CallNextHookEx(0, code, wparam, lparam);
}
Note that you need a low-level keyboard hook. A normal keyboard hook (WH_KEYBOARD) won't catch hotkey events.
The registry-based solution on its own completely disables locking the system (even via the Start menu).
Here is a method that actually provides a way to lock the computer without the Win-L chord. Locking can either be done via a shortcut on the taskbar or by pressing them in sequence followed by Enter.
First, create a batch file that can toggle system locking and trigger the lock itself; instructions for doing this are taken from a forum post:
Create reg-edit files for turning system locking on or off. This is the same as in Brent Foust's answer.
In DisableLockWorkstation.reg:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
"DisableLockWorkstation"=dword:00000001
In EnableLockWorkstation.reg:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
"DisableLockWorkstation"=-
Run the reg-edit script for disabling the system lock.
Create a batch file to toggle the feature using the .reg files:
regedit /S EnableLockWorkstation.reg
rundll32.exe user32.dll,LockWorkStation
regedit /S DisableLockWorkstation.reg
Now, you can create a shortcut and pin it to the taskbar:
Right-click on the batch file and create a shortcut.
Right-click on the new shortcut, edit the shortcut properties, and change target to cmd.exe /C "<path>\lock.bat", where <path> is the full path to the lock.bat file.
The shortcut should now be pinnable to the taskbar (this is not true prior to manually changing the target); it can be dragged there as normal.
(Note that you may also want to change the icon to something like a padlock before pinning the shortcut to the taskbar.)
As mentioned above, once you've completed the above procedure, you should be able to lock the computer using Win, L, Enter in sequence (not as a chord--though see below for a solution using Ctrl-Alt-L as a chord). This is because that sequence is interpreted as follows:
Win -- brings up the Start menu, although you don't actually need to wait for it to load
L -- searches for the custom lock-script; on my machine, the lock.bat shortcut was always the first L result if it was the only shortcut on my taskbar starting with L. (Verify this before attempting to lock your computer this way!)
Enter -- once the search finds an item, it will be launched--i.e. the shortcut will be called, and your computer will lock. You do not need to wait for the search to load; you can quickly press Win, L, Enter in sequence and walk away. The screen will not lock immediately, but it should lock within a few seconds.
Below is a picture of the taskbar shortcut I made (using this icon):
EDIT: Using a chord, such as Ctrl-Alt-L
In the comments below, user lub094 suggests a way to assign the shortcut to the chord Ctrl-Alt-L (or whatever shortcut you'd like). I have not taken the time to test this because I've re-enabled the system shortcut, but I assume that it works.
Use the built-in shortcut-creation feature to assign the chord:
Place the shortcut itself in the Start Menu folder:
"C:\Users\ [user_name]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\ [custom_folder]\"
Looks like you can't.
You can disable all built-in Windows
hotkeys except Win+L and Win+U by
making the following change to the
registry (this should work on all OSes
but a reboot is probably required):
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
NoWinKeys REG_DWORD 0x00000001 (1)
(http://www.autohotkey.com/docs/misc/Override.htm)
But you could try using Tweak UI. Under the Explorer tree view item, uncheck "Enabled Windows+X" hotkeys. Hoekey also might work, haven't tried it. Source.
The #FrancoisB method works for Win8 and Win7. To automate the solution:
Create a text file with the .reg suffix (DisableWinL.reg, for example)
Paste the following content and save the file:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
"DisableLockWorkstation"=dword:00000001
Open that file with RegEdit (double-click should work) to execute the change.
This file can be copied to a new machine to repeat the process. And another one named something like "EnableWinL.reg" could be created that re-enables the Win+L key:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
"DisableLockWorkstation"=dword:00000000
Use power toys for windows 10.
There you have options to remap shortcuts..
download power toys