|
现在不知道objectarx2007的程序框架如何。自己照着2000objectarx的书上的例子写了一个,编译连接都通过了,也可以加载,但输入命令总是说找不到相关命令。
工程名为Arx1。我生成工程之后就改了两个文件,如下,红色的代码是我加入的
一个是acrxEntryPoint.cpp
#include "StdAfx.h"
#include "resource.h"
//-----------------------------------------------------------------------------
#define szRDS _RXST("fff")
//-----------------------------------------------------------------------------
//----- ObjectARX EntryPoint
void initApp();
void unloadApp();
class CArx1App : public AcRxArxApp {
public:
CArx1App () : 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) ;
acrxDynamicLinker->unlockApplication(pkt); initApp();
// TODO: Add your initialization code here
return (retCode) ;
}
virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {
// TODO: Add your code here
unloadApp();
// You *must* call On_kUnloadAppMsg here
AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ;
// TODO: Unload dependencies here
return (retCode) ;
}
virtual void RegisterServerComponents () {
}
} ;
//-----------------------------------------------------------------------------
IMPLEMENT_ARX_ENTRYPOINT(CArx1App)
还有一个是Arx1.cpp
#include "StdAfx.h"
#include "resource.h"
//-----------------------------------------------------------------------------
//- DLL Entry Point
extern "C"
BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) {
//- Remove this if you use lpReserved
UNREFERENCED_PARAMETER(lpReserved) ;
if ( dwReason == DLL_PROCESS_ATTACH ) {
_hdllInstance =hInstance ;
} else if ( dwReason == DLL_PROCESS_DETACH ) {
}
return (TRUE) ;
}
void firstARX();
void initApp()
{
acedRegCmds->addCommand((const ACHAR*)"ArxProject1_Commands",
(const ACHAR*)"showname",
(const ACHAR*)"thefirst",
ACRX_CMD_TRANSPARENT|ACRX_CMD_USEPICKSET,
firstARX);//注册命令
}
void unloadApp()
{
acedRegCmds->removeGroup((const ACHAR*)"ArxProject1_Commands"); //卸载命令
}
void firstARX()
{
ads_alert((const ACHAR*)"this is my first .net arx");
}
|
|