如何将CAD的内置对话框作为当前对话框的子对话框调出

本文参考以下博文并完善了代码实现:https://www.cnblogs.com/shankun/p/To_use_AutoCAD_internal_Dialog.html

常用的几个对话框对应的函数为:
1、尺寸标注样式编辑对话框:
int acedEditDimstyleInteractie(AcDbDatabase *,AcDbDimStyleTableRecord *,int);
2、多行文字编辑对话框:
int acedEditMTextInteractie(AcDbMText *);
3、公差编辑对话框:
void acedEditToleranceInteractie(AcDbFcf *);
4、CAD自己的文件对话框:
int acedGetFileD(const char *,const char *,const char *,int,struct resbuf *);
int acedGetFileNavDialog(const char ,const char ,const char ,const char ,int,struct resbuf);
5、填充面板对话框:
extern bool acedHatchPalletteDialog(const char
Pattern, bool bAllowCustom, char
& result);
6、线形对话框:
bool acedLinetypeDialog(AcDbObjectId,bool,char * &,AcDbObjectId &);
7、线宽对话框:
bool acedLineWeightDialog(AcDb::LineWeight,bool,AcDb::LineWeight &);
8、打印样式对话框:
bool acedPlotstyleDialog(const char *,bool,char * &);
9、填充编辑对话框:
void hatchedit(long,int,bool,const AcDbObject *);
10、文字样式对话框:
void inokeTextStyleDialog(AcDbDatabase *,CString *);

这些函数大多不在文档中,可按两种方式使用:
1、使用前声明函数原型,直接调用即可,注意使用前需要切换资源模块。

void ShowLineWeightDlg()
{
	//声明原型
	bool acedLineWeightDialog(AcDb::LineWeight, bool, AcDb::LineWeight &);
	HMODULE hModule = GetModuleHandle(_T("acad.exe"));
	CAcModuleResourceOverride cadResource(hModule);
	AcDb::LineWeight nLWeight;
	if (acedLineWeightDialog(AcDb::LineWeight::kLnWt020, true, nLWeight))
	{
		//... do something
		acutPrintf(_T("hello"));
	}
}

2、先用GetModuleHandle获取acad.exe的句柄,然后用GetProcAddress动态获取指定函数的入口地址,之后就可以直接调用了。

void ShowLineWeightDlg()
{
	//声明原型
	typedef bool(*DlgLineWeight)(AcDb::LineWeight, bool, AcDb::LineWeight &);
	HMODULE hModule = GetModuleHandle(_T("acad.exe"));
	if (hModule)
	{
		AcDb::LineWeight nLWeight;
		CAcModuleResourceOverride cadResource(hModule);
		//在C++中,会发生名称改编,
		// acedLineWeightDialog名称改编为:?acedLineWeightDialog@@YA_NW4LineWeight@AcDb@@_NAEAW412@@Z
		FARPROC pFunc = GetProcAddress(hModule, "?acedLineWeightDialog@@YA_NW4LineWeight@AcDb@@_NAEAW412@@Z");
		DlgLineWeight pFunLWeight = (DlgLineWeight)pFunc;
		if (pFunLWeight)
		{
			if (pFunLWeight(AcDb::LineWeight::kLnWt025, true, nLWeight))
			{
				//... do something
				acutPrintf(_T("hello"));
			}
		}
	}
}

公用库报表控件类:
CReportRecordItemAcCmColor
CReportRecordItemAssocVariable
CReportRecordItemBlock
CReportRecordItemBool
CReportRecordItemCellAlignment
CReportRecordItemLinetype
CReportRecordItemLineWeight
CReportRecordItemNumber
CReportRecordItemPropertyString
CReportRecordItemSymbol

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

_Santiago

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值