NX二次开发获取NX主程序路径

//头文件

#include <Windows.h>

#include <iostream>

#include <NXOpen/ListingWindow.hxx>

//定义函数

string GetNXPath();

//获取NX主程序路径
string MyClass::GetNXPath()
{
char NXPath[MAX_PATH];
GetModuleFileNameA(NULL, NXPath, MAX_PATH);
string NX_path = NXPath;
return NX_path;
}

void MyClass::do_it()
{

// 打开信息窗口

theSession->ListingWindow()->Open();

string NXFullPath = GetNXPath();

//输出路径到信息窗口
theSession->ListingWindow()->WriteLine(NXFullPath);

}

怡宁塑胶模具设计
原文地址:https://www.cnblogs.com/hqsalanhuang/p/15188746.html