static const long g_HotKeyCMD = WM_USER + 1;
::RegisterHotKey(this->m_hWnd, ::g_HotKeyCMD, MOD_WIN, ‘Z‘);
BEGIN_MESSAGE_MAP(CXBATDlg, CDialog)
ON_MESSAGE(WM_HOTKEY, OnHotKay)
...
END_MESSAGE_MAP()
LRESULT CXBATDlg::OnHotKay(WPARAM wParam, LPARAM pParam)
{
if (wParam == ::g_HotKeyCMD)
{
// ...
return 0;
}
//...
return 0;
}
BOOL CXBATDlg::PreTranslateMessage(MSG* pMsg)
{
this->UpdateData();
if(pMsg->wParam == VK_RETURN)
{
static CString batPath = "";
if (batPath == "")
{
CString strAppPath;
CXBATDlg::GetAppPath(strAppPath);
batPath = strAppPath + "MyBAT\\run.bat";
}
::ShellExecute(this->m_hWnd, "open", batPath,
this->m_CMD.GetBuffer(), NULL, SW_HIDE);
this->m_CMD = "";
this->UpdateData(FALSE);
return true;
}
return CDialog::PreTranslateMessage(pMsg);
}
if %1==bd (
start /max "C:\...\360se.exe" "www.baidu.com"
)
if %1==bd (
call openurl "www.baidu.com"
)
start "C:\...\VSLauncher.exe" "%1"
start /max "C:\...\360se.exe" %1
start "" %1
start %1
set found=0
@echo off&setlocal enabledelayedexpansion
for /f "tokens=1,2,3 delims= " %%i in (store.txt) do (
if %%i==%1 (
set p=%%j&set p1=!p:#p#=%path%!&set p2=!p1:#f#=%folder%!&set p3=!p2:#s#=%SystemRoot%!
if %%k==s (
call opensln !p3!
)
if %%k==f (
call openfolder !p3!
)
if %%k==u (
call openurl !p3!
)
if %%k==o (
call openexe !p3!
)
echo 找到选项 %%k
set found=1
)
)
kfgj E:\开发工具 f
gjrj E:\工具软件 f
dzs E:\电子书 f
bd www.baidu.com u
cbs http://www.cnblogs.com u
csdn www.csdn.net u
a http://localhost/admin u
h http://localhost/ u
126 www.126.com u
wk http://wenku.baidu.com u
rz F:\.../...xls o
ss F:\...\.....sln s
if %found%==1 (
goto start
)
if %1==iisreset (
start iisreset
goto start
)
if %1==iis (
start C:\WINDOWS\system32\inetsrv\iis.msc
goto start
)
if %1==fw (
start %SystemRoot%\system32\services.msc /s
goto start
)
if %1==yc (
start %SystemRoot%\system32\mstsc.exe
goto start
)
if %1==jsq (
start %SystemRoot%\system32\calc.exe
goto start
)
原文地址:http://blog.csdn.net/xumingxsh/article/details/38752851