ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

CAD ObjectARX二次开发之MFC对话框调用

2022-07-06 13:31:15  阅读:181  来源: 互联网

标签:MyCommand1 MFC 对话框 void here 窗体 二次开发 -------------------------------------------


一、创建工程

参考步骤:https://www.cnblogs.com/chenshuangjian/p/16450346.html

注意:创建工程是注意勾选MFC support。

image

二、添加MFC对话框资源

1、鼠标右击,添加资源

image

2、创建Dialog界面

image

image

3、从工具箱拖拽控件到界面

image

4、课在资源视图中查看窗体资源

image

三、引用资源

1、鼠标右键,添加类,选择MFC Support Class Wizard

image

2、填写类型,选择继承基类,上一步骤添加的窗体资源ID

image

四、编码调用窗体

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、编译测试

image

标签:MyCommand1,MFC,对话框,void,here,窗体,二次开发,-------------------------------------------
来源: https://www.cnblogs.com/chenshuangjian/p/16450443.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有