NX二次开发源码分享: 如何获取系统相关信息
使用ufun的 UF_ask_system_info,通过结构体可以获取诸多信息,以下代码的输出结果如下:Date : 2014/01/22 17:28:04
machine_type : GenuineIntel Family 6 Model 10 Stepping 9, Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz
node_name : teamcenter10
os_name : Windows NT (x64)
os_version : 6.1 (Server) (Build 7601: Service Pack 1)Terminal
program_name : NX 9.0.0.19
user_name : Administrator
static void do_api()
{
UF_system_info_t sysinfo;
UF_ask_system_info(&sysinfo);
vector<string> info;
char msg = " ";
sprintf(msg,"Date : %s\n",sysinfo.date_buf);
info.push_back(msg);
sprintf(msg,"machine_type : %s\n",sysinfo.machine_type);
info.push_back(msg);
sprintf(msg,"node_name : %s\n",sysinfo.node_name);
info.push_back(msg);
sprintf(msg,"os_name : %s\n",sysinfo.os_name);
info.push_back(msg);
sprintf(msg,"os_version : %s\n",sysinfo.os_version);
info.push_back(msg);
sprintf(msg,"program_name : %s\n",sysinfo.program_name);
info.push_back(msg);
sprintf(msg,"user_name : %s\n",sysinfo.user_name);
info.push_back(msg);
UF_free_system_info(&sysinfo);
// write the information to listing window
UF_UI_exit_listing_window();
UF_UI_open_listing_window();
int size = info.size();
for (int i=0; i<size; i++)
{
UF_UI_write_listing_window(info.c_str());
}
}
<p> </p>
额,这个可以有
页:
[1]