C++ 2010
//用户代码
#include <NXOpen/ListingWindow.hxx> //打印信息
#include <NXOpen/NXException.hxx> //异常处理
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/BasePart.hxx>
#include <atlstr.h>
#include <iostream>
#include <sstream>
//用户代码
theSession->ListingWindow()->Open();//打开信息窗口
BasePart *basedisplaypart = theSession->Parts()->BaseDisplay();//获取顶层显示部件
NXString directory = basedisplaypart->FullPath();//获取顶层显示部件路径
string filedirectorypath = directory.GetLocaleText();//字符串转换
int end1 = (int)filedirectorypath.find_last_of("\\");//找到顶层显示部件路径中的最后一个反斜杠
string filedirectorypath1 = filedirectorypath.substr( 0, end1 + 1 );//分割部件全路径名获取显示部件路径
//theSession->ListingWindow()->WriteLine(filedirectorypath1);
//方法一
ShellExecute(NULL,"open","Explorer.exe",filedirectorypath1.c_str(),NULL,SW_SHOWDEFAULT);
//方法二
//char filedirectorypath2[256];
//sprintf (filedirectorypath2,"start \"\" \"%s\"",filedirectorypath1.c_str());
//theSession->ListingWindow()->WriteLine(filedirectorypath2);
//system(filedirectorypath2); //打开路径