AcRx::AppRetCode ArxDbgApp::initApp() { acrxUnlockApplication(m_acadAppPtr); acrxDynamicLinker->registerAppMDIAware(m_acadAppPtr); // get the name of this app so we can find where other // things are located. CString appFileName = acedGetAppName(); char dir[_MAX_DIR], drive[_MAX_DRIVE], path[_MAX_PATH]; _splitpath(appFileName, drive, dir, NULL, NULL); _makepath(path, drive, dir, NULL, NULL); m_appPath = path; CWnd* splashScreen = startSplashScreen(); registerClasses(); registerCommands(); acrxBuildClassHierarchy(); m_appServicePtr = acrxRegisterService("ArxDbgServices"); ArxDbgAppEditorReactor::getInstance(); MapTestReactor::getInstance(); registerDialogExtensions(); registerAppMenu(); endSplashScreen(splashScreen); m_didInit = true; return AcRx::kRetOK; }
CString CDlgFtpDown::GetCurArxAppPath() { CString appFileName = acedGetAppName(); char dir[_MAX_DIR], drive[_MAX_DRIVE], path[_MAX_PATH]; _splitpath(appFileName, drive, dir, NULL, NULL); _makepath(path, drive, dir, NULL, NULL); return path; }
void RegisterZrxApp() { // Fill the AppInfo structure with our demand loading details. AcadAppInfo appInfo; appInfo.setAppName(_T("DatabaseOp"));// Application Name appInfo.setModuleName(acedGetAppName());// ARX File Location appInfo.setAppDesc(_T("DatabaseOp Sample")); // Description appInfo.setLoadReason( // Specify when we want this to load AcadApp::LoadReasons( AcadApp::kOnCommandInvocation | AcadApp::kOnLoadRequest)); appInfo.writeToRegistry(false, true);// Write the AppInfo to the registry, don't write to DBX registry section. appInfo.writeGroupNameToRegistry(_T("DATABASEOP_CMDS")); // Write the Group Name appInfo.writeCommandNameToRegistry(_T("CREATEDB"), _T("CREATEDB"));// Write our command. appInfo.writeCommandNameToRegistry(_T("READDB"), _T("READDB"));// Write our command. }
void registerForDemandLoading() { // Fill the AppInfo structure with our demand loading details. AcadAppInfo appInfo; appInfo.setAppName(APPNAME);// AppName appInfo.setModuleName(acedGetAppName());// The physical location of the module appInfo.setAppDesc("Rectangle");// Description appInfo.setLoadReason( // Specify when we want this app to load. AcadApp::LoadReasons( AcadApp::kOnCommandInvocation | AcadApp::kOnLoadRequest)); appInfo.writeToRegistry(false,true);// Write the AppInfo to the registry, don't write to DBX registry section. appInfo.writeGroupNameToRegistry(GROUPNAME);// Write the group, appInfo.writeCommandNameToRegistry("RECTANGLE","RECTANGLE"); // and the commands. appInfo.writeCommandNameToRegistry("RECTANG","RECTANG"); }
void AppToolBar::CreateToolBars() { CMDIFrameWnd* pMainFrame = acedGetAcadFrame(); pMainFrame->LockWindowUpdate(); // 获取主菜单组 IAcadMenuGroup* mnuGrp = NULL; if ( !GetAcadMenuGroup( &mnuGrp ) ) return ; //得到所有菜单组 HRESULT hr = S_OK; IAcadToolbars* acToolbars = NULL; hr = mnuGrp->get_Toolbars( &acToolbars ); CString appFileName = acedGetAppName(); //取出完整的应用程序名称,含路径 TCHAR dir[_MAX_DIR], drive[_MAX_DRIVE], path[_MAX_PATH]; _tsplitpath( appFileName, drive, dir, NULL, NULL ); _tmakepath( path, drive, dir, NULL, NULL ); VARIANT index; VariantInit( &index ); V_VT( &index ) = VT_I4; TCHAR MenuName[256]; int delta = 30; // 工具栏间距 int top = 200, left = 200; for ( int i = 0; i < m_menuCount; i++ ) { IAcadToolbar* acToolbar = NULL; _tcscpy( MenuName, m_TopMenuNames[i] ); hr = acToolbars->Add( MenuName, &acToolbar ); acToolbar->put_Visible( true ); acToolbar->Dock( acToolbarFloating ); acToolbar->Float( top + i * delta, left, 1 ); CCADToolButtonArray* Menus = m_menus[i]; COleVariant flyOutButton; for ( int j = 0; j < Menus->GetSize(); j++ ) { // 添加按钮 V_I4( &index ) = ( long )j; CADToolButton* btn = Menus->GetAt( j ); IAcadToolbarItem* acToolbarItem = NULL; if( _tcscmp( _T( "--" ), btn->name ) == 0 ) { hr = acToolbar->AddSeparator( index, &acToolbarItem ); } else { hr = acToolbar->AddToolbarButton( index, btn->name, btn->help, btn->order, flyOutButton, &acToolbarItem ); CString bmpFile; bmpFile.Format( _T( "%s%s\\%s" ), path, BMP_DIR, btn->bmp ); TCHAR szBmpFile[256]; _tcscpy( szBmpFile, bmpFile ); //acutPrintf(_T("\n路径:%s"), szBmpFile); hr = acToolbarItem->SetBitmaps( szBmpFile, szBmpFile ); } } //acToolbarItem->Release(); acToolbar->Release(); } acToolbars->Release(); mnuGrp->Release(); pMainFrame->UnlockWindowUpdate(); stcMyToolBarNames.Copy( m_TopMenuNames ); //将工具栏名称存入静态数组中,卸载时使用 }