|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
使用ufun的 UF_ask_system_info,通过结构体可以获取诸多信息,以下代码的输出结果如下:/ x; u( \& Q0 Y& Z
! J! [# x( W# f0 F% L
Date : 2014/01/22 17:28:04
: I- i# g* J$ cmachine_type : GenuineIntel Family 6 Model 10 Stepping 9, Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz. r0 m. F3 K3 C/ q/ M
node_name : Teamcenter10
I. X5 `/ b, s2 Nos_name : Windows NT (x64) Y2 `' L5 k/ h6 t' U- @5 G7 d Q/ A
os_version : 6.1 (Server) (Build 7601: Service Pack 1) Terminal
# g. s2 P) I- _. f/ c3 H9 xprogram_name : NX 9.0.0.194 d _/ f! m5 i) K
user_name : Administrator Q4 V: E0 H+ h3 m; r
4 }/ I% d. N* I+ B% B; N- static void do_api()2 l) b1 _* E c J! `. h O" V
- {7 f0 Y8 a; Q, Z# |8 ?* w2 s7 c
- ) D) _9 ?5 u) _# H. m8 M
- UF_system_info_t sysinfo;
+ P) l0 z' z7 _/ R! S - UF_ask_system_info(&sysinfo);8 I, C$ G0 u" `5 A! J- A' k
- vector<string> info;* t- r7 I3 O' S# G; @0 Q2 v
- char msg[256+1] = " ";
& h; j+ A& a2 [0 L8 Q) E- D - sprintf(msg,"Date : %s\n",sysinfo.date_buf);
9 Z$ x' G: Q1 k, u3 _ - info.push_back(msg);
2 O, C% J5 k3 ^: p, c2 a; R/ w# B - sprintf(msg,"machine_type : %s\n",sysinfo.machine_type);* M- X* Z7 P/ e; v+ x
- info.push_back(msg);8 a' I( r5 u$ f- t, P5 E: c
- sprintf(msg,"node_name : %s\n",sysinfo.node_name);
& \& U" M4 g. X4 w# L$ c9 J - info.push_back(msg);
, q3 x6 j. c9 w( U. U, Z8 d: } - sprintf(msg,"os_name : %s\n",sysinfo.os_name);
! A; e# H9 `+ e4 X7 I1 r - info.push_back(msg);
4 B% x) G0 u0 o- ~: F% X! w% Q, O" q - sprintf(msg,"os_version : %s\n",sysinfo.os_version);3 o+ z+ u8 }0 J7 e$ |
- info.push_back(msg);- t2 S3 n4 K9 k! w
- sprintf(msg,"program_name : %s\n",sysinfo.program_name);; w d0 R8 _2 s) u
- info.push_back(msg);
) A3 f0 [% @+ R, H7 B* H$ Q2 M - sprintf(msg,"user_name : %s\n",sysinfo.user_name);: G7 R& \% Y3 e* W" }* n4 X
- info.push_back(msg);
; R+ H6 m! p+ I/ x3 Q - UF_free_system_info(&sysinfo);( i% S" [* K- P' h C; [8 l0 i
- // write the information to listing window+ h. q% o- m6 b; j7 h
- UF_UI_exit_listing_window();
4 E- s: Z4 N5 p R - UF_UI_open_listing_window();
' m/ A3 {1 D) P1 w! I - int size = info.size();8 s8 Z+ U& \: M4 s: B0 P$ l
- for (int i=0; i<size; i++)& x3 C: ^5 B" z$ Q
- {6 e; @7 L* j( V+ P0 h% }, q* [
- UF_UI_write_listing_window(info[i].c_str());
' X+ T0 H2 V1 f i' t - }
Y- l) I2 r4 L* J& G9 ^ - }
+ M. w1 M$ W$ a7 ?- ^! f4 f$ q - <p> </p>
复制代码 . S; i7 p+ W" E7 P% q
|
|