kdub 发表于 2009-5-10 22:17:11

最小ARX模块

#include
#include
#include
void hello(){
MessageBox(NULL,L"Hello World\t.",L"Message", MB_ICONINFORMATION);
}
EXTERN_C int acrxEntryPoint(int msg, void* app){
if(msg == AcRx::kInitAppMsg){
      acrxDynamicLinker->unlockApplication(app);
      acrxDynamicLinker->registerAppMDIAware(app);
      acedRegCmds->addCommand(L"MyGroup",L"Hello",L"Hello", NULL, hello);
}
if(msg == AcRx::kUnloadAppMsg){
    acedRegCmds->removeGroup(L"MyGroup");
}
return AcRx::kRetOK;
}

**** Hidden Message *****

MickD 发表于 2009-5-10 22:25:54


你至少可以对它进行优化,丹

MickD 发表于 2009-5-10 23:33:37

很难说Switch和If哪个更快。
; 10   :   if(msg == AcRx::kInitAppMsg){
        mov        eax, DWORD PTR _msg$
        cmp        eax, 1
        push        esi
        jne        $LN2@acrxEntryP
; 11   :       acrxDynamicLinker->unlockApplication(app);
; 12   :       acrxDynamicLinker->registerAppMDIAware(app);
; 13   :       acedRegCmds->addCommand(L"MyGroup",L"Hello",L"Hello", NULL, hello);
; 17   :   }
; 18   :   return AcRx::kRetOK;
        xor        eax, eax
        pop        esi
; 19   : }
        ret        0
$LN2@acrxEntryP:
; 14   :   }
; 15   :   if(msg == AcRx::kUnloadAppMsg){
        cmp        eax, 2
        jne        SHORT $LN21@acrxEntryP
; 16   :   acedRegCmds->removeGroup(L"MyGroup");
; 17   :   }
; 18   :   return AcRx::kRetOK;
        xor        eax, eax
        pop        esi
; 19   : }
        ret        0
; 16   :   acedRegCmds->removeGroup(L"MyGroup");
$LN21@acrxEntryP:
; 17   :   }
; 18   :   return AcRx::kRetOK;
        xor        eax, eax
        pop        esi
; 19   : }
        ret        0

; 10   :   switch (msg) {
        mov        eax, DWORD PTR _msg$
        sub        eax, 1
        push        esi
        je        SHORT $LN2@acrxEntryP
        sub        eax, 1
        jne        $LN23@acrxEntryP
; 15   :       break;
; 16   :   case AcRx::kUnloadAppMsg:
; 17   :       acedRegCmds->removeGroup(L"MyGroup");
; 18   :   }
; 19   :   return AcRx::kRetOK;
        xor        eax, eax
        pop        esi
; 20   : }
        ret        0
; 15   :       break;
; 16   :   case AcRx::kUnloadAppMsg:
; 17   :       acedRegCmds->removeGroup(L"MyGroup");
; 18   :   }
; 19   :   return AcRx::kRetOK;
        xor        eax, eax
        pop        esi
; 20   : }
        ret        0
$LN2@acrxEntryP:
; 11   :   case AcRx::kInitAppMsg:
; 12   :       acrxDynamicLinker->unlockApplication(app);
; 13   :       acrxDynamicLinker->registerAppMDIAware(app);
; 14   :       acedRegCmds->addCommand(L"MyGroup",L"Hello",L"Hello", NULL, hello);
$LN23@acrxEntryP:
; 18   :   }
; 19   :   return AcRx::kRetOK;
        xor        eax, eax
        pop        esi
; 20   : }
        ret        0

MickD 发表于 2009-5-10 23:54:55


void hello(){
acutPrintf(_T("\nHello World!"));
}
保存另一个窗口

MickD 发表于 2009-5-13 21:42:22

(没有任何测试)或者使用On_kLoadDwgMsg,并在那里简单地放置acutPrintf(_T("\nHello World!"));....有可能。

MickD 发表于 2009-5-13 22:21:32

True
我试图击败别人最小的DRX套路,它有一个命令
页: [1]
查看完整版本: 最小ARX模块