|
|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>2 n7 w3 l/ G9 Y! j- o9 B3 k
#include <uf.h>2 i- D1 U( q- t& t3 \/ [8 E
#include <uf_ui.h>; h. |5 f9 r1 h6 z/ J: B2 u4 C
#include "UG_UI.h"
% q+ x" |9 Y" y1 S8 A+ d#include <uf_mb.h>) r: V! w; N: w! |- p6 d+ @
#include "UG_UI_calculate_dialog.h"$ z9 j7 H- \* [6 W+ `
) o; ] _% A# R6 P9 z4 ^1 l( Q
/*****************************************************************************
. g, N, @; j% a$ R" d** Activation Methods
" X3 L1 K: E/ b* g+ k O/ V*****************************************************************************/
; ~" L. P+ n6 M# k9 t! b9 A4 N
- d2 ]- q! |- H- L/* Unigraphics Startup
7 W- |4 s3 a0 y1 X, s9 B* F4 A** This entry point activates the application at Unigraphics startup */
. v% a: I0 l8 {, ~; {1 c7 aextern DllExport void ufsta( char *param, int *returnCode, int rlen )
3 C/ j8 o2 E- R7 n) r8 D/ R9 i{
: h. ^1 ^+ M4 o8 q, ?' {* c /* Initialize the API environment */. {/ d8 e% _8 X
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
" F$ @7 @$ k' _. M UF_MB_data_t,UF_MB_activated_button_p_t );, ?! h2 c0 n7 X& m# ?% j
static UF_MB_action_t actionTable[]=
3 j9 a, f3 G9 _3 [ {
# N. H M: R' [, u6 M" a" s- w# k {"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
9 }3 ?5 \9 g8 W) s, o0 z {NULL,NULL,NULL}
4 m' Z4 V8 }: t& S };
, T- j6 p, z# M5 B int errorCode = UF_initialize();
" b Z, H- g4 f if ( 0 == errorCode )+ W- X0 h: B5 `
{2 U7 _% |6 E+ j& l. g: m
UF_MB_add_actions(actionTable);
0 @+ M+ l0 ~7 U# `. ^6 p6 ~$ r ^' x errorCode = UF_terminate();( C/ x$ k; ]( J' Z U" r0 T
}& W$ g8 J7 @8 g2 u
PrintErrorMessage( errorCode );
9 o1 i+ i/ Q) n" N0 e* v/ m0 A0 v4 ^}- Z% X# `; I$ M V$ J+ M
8 k4 Z% L7 _5 H+ D- O2 ^
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
; j! J+ g. y W& c! V" q E UF_MB_widget_t widget,
7 ?; ~3 X4 P- P9 I' @8 j# b" I8 L UF_MB_data_t client_data,0 s+ F' {+ f( j! t) o
UF_MB_activated_button_p_t call_button2 [# h/ S+ x$ n
)
9 b& \1 g; ~3 _* j% l{% A1 j* p8 K3 X- e: d
UG_UI_calculate_data m_data;
A% e6 D6 n, [& S' G! { int response;4 P3 G2 m: |8 G5 |
LaunchCalculateDialog( &response ,&m_data);
% ~: T) U) `) U0 _. @3 V+ z return UF_MB_CB_CONTINUE ;
' M/ y+ `2 B$ B( H& e. O( K- X9 }}
1 T; Y- P4 I1 m8 v+ `' C( g8 n1 ^3 f/*****************************************************************************
9 V+ h# [9 D o** Utilities
7 i1 p) T0 J/ r( O9 `*****************************************************************************/: h0 k& e7 m) T; o5 [4 m
- g H5 R2 F$ Q* X3 n
/* Unload Handler
; S! t4 K) F! d8 m** This function specifies when to unload your application from Unigraphics.
, ~- @# c7 z& v* u/ d** If your application registers a callback (from a MenuScript item or a* n6 B3 r2 H* c! V0 O& r0 ~
** User Defined Object for example), this function MUST return9 g. ]6 g1 o" w. R6 Z
** "UF_UNLOAD_UG_TERMINATE". */
7 o5 }* }1 W0 {9 uextern int ufusr_ask_unload( void )
& k1 u7 F# E$ c{8 _7 ` x) K+ p0 I4 T {% r# K3 U
return( UF_UNLOAD_IMMEDIATELY );4 o0 D6 ^6 R3 D0 u& R( ?' B0 F
}
* A& d) h" E/ m; N
+ t: w# n& B$ f1 r! |* J/* PrintErrorMessage
/ n# H- v9 m8 k& A**
9 f5 Q4 g+ G9 L5 X9 }9 c5 v( I** Prints error messages to standard error and the Unigraphics status
$ H7 M$ A5 f& M, u** line. */
# D" h/ n1 [4 P' G, Ostatic void PrintErrorMessage( int errorCode )
% x2 H* d3 O1 [2 E{- V3 H* R' F# Q5 ^3 m
if ( 0 != errorCode ): c C: Y3 \: z
{
" q2 w* y, L1 t+ T- q8 ?0 ` /* Retrieve the associated error message */0 P; A6 ~1 G M2 H! H# y) i
char message[133];
+ B' G, E' V8 } UF_get_fail_message( errorCode, message );2 u5 K& m5 I. c! e
$ H: k8 y' F& ?# C
/* Print out the message */
6 |- [9 ]# K$ q# \' a UF_UI_set_status( message );/ _: C ^3 F; H$ y
. D, H$ `( F. _0 C" ^" }) N
fprintf( stderr, "%s\n", message );
7 F$ {" _1 \$ U0 R- x: h5 [2 b }
# \, y' X) G5 y3 `# H) H( S" e}( Y. H* m# Z9 q) g' L# ~3 Y
以上代码编译之后显示, R9 A$ W# a( g% c% D! L. w6 J
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int! @" u4 r* N$ \+ y
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
8 x+ W4 O) f, L2 M自己怎么都解决不了,不知道哪位大哥可以指点一下小弟
: t; N+ @9 }+ b# W* G( ~7 A. X2 Y! K8 L$ Y
|
|