如何让WinKey+[number]组合运行[number]
Windows XP 快速启动栏中的第一项?换句话说,我想模仿 Windows 7 的行为。
答案1
当然可以,使用 HotKeyBind
http://www.technixupdate.com/assign-window-hotkeys-to-quick-launch-items-in-win-xp-with-hotkeybind/
首先下载并安装热键绑定。
如果正在运行,您将在任务栏中看到一个灰色图标
双击此图标将出现一个新窗口
单击“添加”按钮,然后选择“启动文件>>执行程序”选项,然后单击“确定”
浏览到目标快速启动项文件夹,其路径为:\Documents and Settings\\Application Data\Microsoft\Internet Explorer\Quick Launch
例如:C:\Documents and Settings\zapper\Application Data\Microsoft\Internet Explorer\Quick Launch
注意:在浏览此路径之前,请确保文件夹选项中的“显示隐藏文件和文件夹”设置为“显示”。否则,请复制上述路径并将其粘贴到地址栏中,然后将快速启动项拖到目标框上。
在快速启动项中选择 Gtalk 等程序的快捷方式后,单击“确定”
将打开一个新窗口,标题为“编辑密钥”,单击复选框 WIN 并按任意数字键。
由于 Google Talk 是“开始”按钮后快速启动中的第一个项目,因此我将其快捷方式设置为 Win +1
- 大功告成
答案2
我刚刚自己编写了一个程序来做这件事。
我的可执行文件的 Base64 编码版本:
TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAADJCgP2jWttpY1rbaWNa22lTmQwpYhrbaWNa2ylgWttpU5kCaWMa22lTmQ3pYxrbaVSaWNojWttpQAAAAAAAAAAAAAAAAAAAABQRQAATAECAIysUU4AAAAAAAAAAOAADwELAQcKAAQAAAACAAAAAAAAqREAAAAQAAAAIAAAAABAAAAQAAAAAgAABAAAAAAAAAAEAAAAAAAAAAAwAAAABAAAAAAAAAIAAAQAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAAAwSAAA8AAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
源代码:
//Flags: /O1 /link /NoDefaultLib /entry:WinMainCRTStartup /Subsystem:Windows
//No need for a C runtime library...
#define _WIN32_WINNT 0x502
#include <tchar.h>
#include <windows.h>
#include <commctrl.h>
static HHOOK hHook = NULL;
LRESULT CALLBACK KeyboardHook(IN int nCode,
IN WPARAM wParam, IN LPARAM lParam)
{
BOOL suppress = FALSE;
LPKBDLLHOOKSTRUCT pKBDHS = (LPKBDLLHOOKSTRUCT)lParam;
int nKey = pKBDHS->vkCode - 0x30;
if (nCode >= 0 && wParam == WM_KEYDOWN && 0 <= nKey && nKey <= 9)
{
if (nKey == 0)
{
/*Quit*/
suppress = TRUE;
PostQuitMessage(0);
}
else if (GetKeyState(VK_LWIN) < 0 || GetKeyState(VK_RWIN) < 0)
{
HWND hWnd = GetDesktopWindow();
if (hWnd != NULL)
{ hWnd = FindWindowEx(hWnd, NULL, _T("Shell_TrayWnd"), NULL); }
if (hWnd != NULL)
{ hWnd = FindWindowEx(hWnd, NULL, REBARCLASSNAME, NULL); }
if (hWnd != NULL)
{
hWnd = FindWindowEx(hWnd, NULL,
TOOLBARCLASSNAME, _T("Quick Launch"));
}
if (hWnd != NULL)
{
suppress = TRUE;
DWORD btnSize = SendMessage(hWnd, TB_GETBUTTONSIZE, 0, 0);
LONG coord = MAKELONG((nKey - 1) * LOWORD(btnSize), 0);
PostMessage(hWnd, WM_LBUTTONDOWN, 0, coord);
PostMessage(hWnd, WM_LBUTTONUP, 0, coord);
}
}
}
if (suppress) { return 1; }
else if (hHook == NULL) { return 0; }
else { return CallNextHookEx(hHook, nCode, wParam, lParam); }
}
int WinMainCRTStartup()
{
HINSTANCE hInstance = GetModuleHandle(NULL);
hHook = SetWindowsHookEx(WH_KEYBOARD_LL, &KeyboardHook, hInstance, 0);
if (hHook != NULL && hHook != INVALID_HANDLE_VALUE)
{
MSG msg;
BOOL success;
while (success = GetMessage(&msg, NULL, 0, 0))
{
if (success == -1) { break; }
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return 0;
}