本帖最后由 zdqwy19 于 2014-8-6 22:42 编辑
在新版本cad中Ctrl+字母键基本上都被Autodesk公司定义了(在2014中除了Ctrl+R),改用Alt+字母键作为快捷键代替方案。
- // 赵德强 2014.6.21
- //-----------------------------------------------------------------------------
- //----- acrxEntryPoint.cpp
- //-----------------------------------------------------------------------------
- #include "StdAfx.h"
- #include "resource.h"
- //-----------------------------------------------------------------------------
- #define szRDS _RXST("")
- //-----------------------------------------------------------------------------
- //监测函数
- void AltB(const MSG * pMsg);
- static BOOL AltBKey = FALSE;
- void AltB(const MSG *pMsg)
- {
- if (pMsg->wParam == 'B' && (pMsg->lParam>>29 & 1))//监测键盘ALT + B消息
- {
- //调用自定义命令
- acDocManager->sendStringToExecute(acDocManager->curDocument(),_T("test "),false,true);
- }
- return;
- }
- //-----------------------------------------------------------------------------
- //----- ObjectARX EntryPoint
- class CtestApp : public AcRxArxApp {
- public:
- CtestApp () : AcRxArxApp () {}
- virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {
- // TODO: Load dependencies here
- // You *must* call On_kInitAppMsg here
- AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ;
-
- // TODO: Add your initialization code here
- //加载快捷键
- if(AltBKey == TRUE)return;
- acedRegisterWatchWinMsg(AltB);
- acedPrompt(_T("\n提示:使用快捷键Alt+B已经可以使用!\n"));
- AltBKey = TRUE;
- return (retCode) ;
- }
- virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {
- // TODO: Add your code here
- // You *must* call On_kUnloadAppMsg here
- AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ;
- // TODO: Unload dependencies here
- //卸载快捷键
- if(AltBKey == TRUE) acedRemoveWatchWinMsg(AltB);
- return (retCode) ;
- }
- virtual void RegisterServerComponents () {
- }
- public:
- // - bianhao._bianhao command (do not rename)
- static void test_test(void)
- {
- // Add your code for command bianhao._bianhao here
- }
- } ;
- //-----------------------------------------------------------------------------
- IMPLEMENT_ARX_ENTRYPOINT(CtestApp)
- ACED_ARXCOMMAND_ENTRY_AUTO(CtestApp, test, _test, test, ACRX_CMD_TRANSPARENT, NULL)
|