作者: | 来源:互联网 | 2023-09-05 11:02
一、创建工程参考步骤:https:www.cnblogs.comchenshuangjianp16450346.html注意:创建工程是注意勾选MFCsupport。二、添加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、编译测试