ObjectARX学习笔记(十六)--如何设置CAD选项对话框的配置AcApProfileManagerReactor反应器
2014-05-30 14:06
363 查看
<pre name="code" class="cpp">如何设置CAD选项对话框的配置 利用>反应器就可以设置
// (C) Copyright 1999-2006 by Autodesk, Inc. // // Permission to use, copy, modify, and distribute this software in // object code form for any purpose and without fee is hereby granted, // provided that the above copyright notice appears in all copies and // that both that copyright notice and the limited warranty and // restricted rights notice below appear in all supporting // documentation. // // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE // UNINTERRUPTED OR ERROR FREE. // // Use, duplication, or disclosure by the U.S. Government is subject to // restrictions set forth in FAR 52.227-19 (Commercial Computer // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) // (Rights in Technical Data and Computer Software), as applicable. // #if defined(_DEBUG) && !defined(AC_FULL_DEBUG) #error _DEBUG should not be defined except in internal Adesk debug builds #endif #include <rxregsvc.h> #include <aced.h> #include <dbxutil.h> #include <acprofile.h> #include <adslib.h> #include "tchar.h" // Define a class derived from AcApProfileManagerReactor to manage // the notifications. // class AsdkProfileManagerReactor : public AcApProfileManagerReactor { public: void currentProfileWillChange(const TCHAR *newProfile); void currentProfileChanged(const TCHAR *newProfile); void currentProfileWillBeReset(const TCHAR *curProfile); void currentProfileReset(const TCHAR *curProfile); void profileWillReset(const TCHAR *profName); void profileReset(const TCHAR *proName); }; // Define the notification functions // void AsdkProfileManagerReactor:: currentProfileWillChange(const TCHAR *newProfile) { acutPrintf(_T("\nCurrent profile will change: %s"), newProfile); } void AsdkProfileManagerReactor:: currentProfileChanged(const TCHAR *newProfile) { acutPrintf(_T("\nCurrent profile changed: %s"), newProfile); } void AsdkProfileManagerReactor:: currentProfileWillBeReset(const TCHAR *curProfile) { acutPrintf(_T("\nCurrent profile will be reset: %s"), curProfile); } void AsdkProfileManagerReactor:: currentProfileReset(const TCHAR *curProfile) { acutPrintf(_T("\nCurrent profile has been reset: %s"), curProfile); } void AsdkProfileManagerReactor:: profileWillReset(const TCHAR *profName) { acutPrintf(_T("\nA non-current profile will be reset: %s"), profName); } void AsdkProfileManagerReactor:: profileReset(const TCHAR *profName) { acutPrintf(_T("\nA non-current profile has been reset: %s"), profName); } void aFunction() { acutPrintf(_T("This is AsdkProfileSample Test Application...\n")); // Attach the reactor for the duration of this command. Normally // this would likely be added upon application initialization. // AsdkProfileManagerReactor *pProfileRector = new AsdkProfileManagerReactor(); acProfileManagerPtr()->addReactor(pProfileRector); // Obtain the path for the registry keys and print it out. // TCHAR *pstrKey; acProfileManagerPtr()->ProfileRegistryKey(pstrKey, NULL); if (pstrKey != NULL) { acutPrintf(_T("\nThe profiles registry key is: %s"), pstrKey); acutDelString(pstrKey); } // Get the list of all profiles in the users configuration // and print them out. // AcApProfileNameArray arrNameList; int nProfiles = acProfileManagerPtr()->ProfileListNames(arrNameList); acutPrintf(_T("\nNumber of profiles currently ") _T("in the user profile list is: %d"), nProfiles); for (int i = 0; i < nProfiles; i++) acutPrintf(_T("\nProfile name is: %s"), arrNameList[i]); // Copy the unnamed profile to the AsdkTestProfile // acProfileManagerPtr()->ProfileCopy(_T("AsdkTestProfile"), _T("<<Unnamed Profile>>"), _T("This is a test")); // Reset the newly copied profile to AutoCAD defualts. // acProfileManagerPtr()->ProfileReset(_T("AsdkTestProfile")); // Make this new profile current. // acProfileManagerPtr()->ProfileSetCurrent(_T("AsdkTestProfile")); // Change a value in the profile. We'll just make the // cursor big. // struct resbuf rbCursorSize; rbCursorSize.restype = RTSHORT; rbCursorSize.resval.rint = 100; acedSetVar(_T("CURSORSIZE"), &rbCursorSize); // Rename the profile to a new name. // acProfileManagerPtr()->ProfileRename(_T("AsdkTestProfile2"), _T("AsdkTestProfile"), _T("This is another test")); // Export the profile. // acProfileManagerPtr()->ProfileExport(_T("AsdkTestProfile2"), _T("./AsdkTestProfile2.arg")); // Import the profile. // acProfileManagerPtr()->ProfileImport(_T("AsdkTestProfile3"), _T("./AsdkTestProfile2.arg"), _T("This is a copy of AsdkTestProfile2") _T("by Exporting/Importing"), Adesk::kTrue); // Remove the reactor. // acProfileManagerPtr()->removeReactor(pProfileRector); } void initApp() { acutPrintf(_T("AsdkProfileSample ARX Test; Type ProfileSample to execute")); // register a command with the AutoCAD command mechanism // acedRegCmds->addCommand(_T("AsdkProfileSample_COMMANDS"), _T("AsdkProfileSample"), _T("ProfileSample"), ACRX_CMD_MODAL, aFunction); } void unloadApp() { // Remove the command group added via acedRegCmds->addCommand // acedRegCmds->removeGroup(_T("AsdkProfileSample_COMMANDS")); } extern "C" AcRx::AppRetCode acrxEntryPoint(AcRx::AppMsgCode msg, void* appId) { switch (msg) { case AcRx::kInitAppMsg: acrxDynamicLinker->unlockApplication(appId); acrxDynamicLinker->registerAppMDIAware(appId); initApp(); break; case AcRx::kUnloadAppMsg: unloadApp(); break; case AcRx::kLoadDwgMsg: break; case AcRx::kUnloadDwgMsg: break; case AcRx::kInvkSubrMsg: break; default: ; } return AcRx::kRetOK; }
相关文章推荐
- Total Commander 7.56 - Team EAT 配置选项 个性化设置备份,,,开启时如何自动最大化???
- 三、highcharts 如何设置图表配置选项
- Android: 如何向系统设置中添加自己的配置选项及配置页面
- 如何在MyEclipse8.5设置server选项以配置部署多个项目
- ObjectARX学习笔记(五)---- 如何弹出标准CAD文件打开和保存对话框acedGetFileD
- 图形的绘制,如何使用自定义画笔(颜色,线宽,线形)。如何为程序中添加选项菜单和选项设置对话框,如何使用标准颜色对话框,如何使用字体对话框,在选项对话框中实现预览功能。实现选项对话框和窗口类中的数据交换。如何改变对话框和控件的背景色,如何改变控件的文本颜色,
- ObjectARX学习笔记(三十二)----如何设置AcDbMText对齐方式
- 【荐2】Total Commander 7.57 配置选项 个性化设置备份,,,开启时如何自动最大化???(二)
- Altiris安装配置学习教程(七)- 配置Deployment Console 选项设置
- 如何配置传入电子邮件设置
- 如何设置对话框背景色以及控件颜色
- ADSL应用设置 如何配置ADSL Modem防火墙
- 如何在对话框中设置默认焦点
- VC编程中如何设置对话框的背景颜色和静态文本颜色
- 如何解决此错误:7405 16 异类查询要求为连接设置 ANSI_NULLS 和 ANSI_WARNINGS 选项。这将确保一致的查询语义。请启用这些选项,然后重新发出查询
- VC编程中如何设置对话框的背景颜色和静态文本颜色
- Mysql:命令选项、配置选项、(全局、会话)系统变量、状态变量:和路径、文件名称相关的设置
- [转]httpd.conf详尽中文解释,如何配置设置,非常详细
- 请问如何设置DropDownList的当前选项?
- VC编程中如何设置对话框的背景颜色和静态文本颜色