CAD ObjectARX二次开发之MFC对话框调用
2022/7/6 23:30:22
本文主要是介绍CAD ObjectARX二次开发之MFC对话框调用,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
一、创建工程
参考步骤:https://www.cnblogs.com/chenshuangjian/p/16450346.html
注意:创建工程是注意勾选MFC support。
二、添加MFC对话框资源
1、鼠标右击,添加资源
2、创建Dialog界面
3、从工具箱拖拽控件到界面
4、课在资源视图中查看窗体资源
三、引用资源
1、鼠标右键,添加类,选择MFC Support Class Wizard
2、填写类型,选择继承基类,上一步骤添加的窗体资源ID
四、编码调用窗体
1、添加窗体类头文件,编写窗体调用代码
// (C) Copyright 2002-2007 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. // //----------------------------------------------------------------------------- //----- acrxEntryPoint.cpp //----------------------------------------------------------------------------- #include "StdAfx.h" #include "resource.h" #include "ArxMFCDialog.h" //----------------------------------------------------------------------------- #define szRDS _RXST("Arx") //----------------------------------------------------------------------------- //----- ObjectARX EntryPoint class CDemo_LoadMFCDialogApp : public AcRxArxApp { public: CDemo_LoadMFCDialogApp () : 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 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 return (retCode) ; } virtual void RegisterServerComponents () { } // - ArxDemo_LoadMFCDialog._MyCommand1 command (do not rename) static void ArxDemo_LoadMFCDialog_MyCommand1(void) { // Add your code for command ArxDemo_LoadMFCDialog._MyCommand1 here //必须添加,防止资源调用冲突 CAcModuleResourceOverride resOverrid; //自定义MFC界面 ArxMFCDialog dialog; //以模态方式加载 if(dialog.DoModal() == IDOK){ } } } ; //----------------------------------------------------------------------------- IMPLEMENT_ARX_ENTRYPOINT(CDemo_LoadMFCDialogApp) ACED_ARXCOMMAND_ENTRY_AUTO(CDemo_LoadMFCDialogApp, ArxDemo_LoadMFCDialog, _MyCommand1, MyCommand1, ACRX_CMD_TRANSPARENT, NULL)
2、编译测试
这篇关于CAD ObjectARX二次开发之MFC对话框调用的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-15PingCAP 黄东旭参与 CCF 秀湖会议,共探开源教育未来
- 2024-05-13PingCAP 戴涛:构建面向未来的金融核心系统
- 2024-05-09flutter3.x_macos桌面os实战
- 2024-05-09Rust中的并发性:Sync 和 Send Traits
- 2024-05-08使用Ollama和OpenWebUI在CPU上玩转Meta Llama3-8B
- 2024-05-08完工标准(DoD)与验收条件(AC)究竟有什么不同?
- 2024-05-084万 star 的 NocoDB 在 sealos 上一键起,轻松把数据库编程智能表格
- 2024-05-08Mac 版Stable Diffusion WebUI的安装
- 2024-05-08解锁CodeGeeX智能问答中3项独有的隐藏技能
- 2024-05-08RAG算法优化+新增代码仓库支持,CodeGeeX的@repo功能效果提升