|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>: W2 F' l+ k z) H" G' C! c3 k) [ n9 r
#include <uf.h>
$ K( t `" u- z5 H1 R ^2 V#include <uf_ui.h>0 A" ?7 `' M0 c3 H% ]( C" T, a
#include "UG_UI.h"7 j+ a G4 G( f7 \
#include <uf_mb.h>
2 L8 t' S! m5 B& B1 J#include "UG_UI_calculate_dialog.h"2 } ^& P% j9 p/ h2 n6 W0 ^
" ]8 ~( k5 K" i h3 g/*****************************************************************************
0 z3 A4 Y2 z7 ~6 @1 W** Activation Methods
3 }( }# ^/ i& u7 C*****************************************************************************/$ z$ H/ \" l( z0 z! X0 ?2 i: [# |
! _- _% {5 }5 \$ L* [! _" ~1 g8 k/* Unigraphics Startup
+ y' G& z4 Y! h9 V& B! X9 T** This entry point activates the application at Unigraphics startup */
. s- n( @: j4 Yextern DllExport void ufsta( char *param, int *returnCode, int rlen )0 t! w) s: U6 C! X( y2 w6 F
{
1 D" ?; o' s1 V6 g8 @7 Q6 s8 i /* Initialize the API environment */
/ A* z0 Z( Q! S4 P6 ~: r static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,0 }5 p$ q# ~" T$ s" ]5 B
UF_MB_data_t,UF_MB_activated_button_p_t );7 t6 ]0 P" [# d( N- ~: ^, N0 o v4 U
static UF_MB_action_t actionTable[]=
. h5 w2 L- _7 ?6 C) P {, b# ~( y3 n2 e" m/ |
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
) E) h( |7 X' v# E8 V) v3 T+ K {NULL,NULL,NULL}3 l5 M" B; l# h
};
) Y5 z2 G( A/ z: m; T int errorCode = UF_initialize();0 ?$ G% p4 q# K/ |4 a
if ( 0 == errorCode )2 B6 n ]# j/ X2 c' |
{3 O9 g; U+ p4 N$ G+ D6 m; f0 a
UF_MB_add_actions(actionTable);& r: a* l. a- k& ^
errorCode = UF_terminate();
5 H4 p0 _! J* g6 k' w x }
7 V: z* @, o3 T9 Q/ W3 M, O PrintErrorMessage( errorCode );
/ b4 \, d! w' E& ?}: P* l. s- D G2 g$ ^! \1 q; L6 b
. v9 d* t, g( p2 n9 X+ `/ ~% p
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(* D* M8 s0 k/ m$ z( Q# C. N+ Q
UF_MB_widget_t widget,
+ N" L3 c: n7 |1 x9 a UF_MB_data_t client_data,$ x2 O( D |- c2 R" T% {9 a: f$ L
UF_MB_activated_button_p_t call_button3 n# m7 v( Q( |6 e7 Q6 ~+ G& Z
)
0 _5 R/ u8 `# Z6 x{
* N2 Y; M2 v: H9 x UG_UI_calculate_data m_data;9 Y' x9 Q9 K! Y% ]. @( W
int response;( M$ X; H% q3 i$ m
LaunchCalculateDialog( &response ,&m_data);
) L1 J3 u- M2 H. U/ { return UF_MB_CB_CONTINUE ; M! s1 |. Z: T5 t3 U _4 A" {
}
2 s/ ^: a& [- ], u% Q' X/*****************************************************************************
8 _4 [& x, x* N& d$ U% t** Utilities. O7 [ J& H7 _
*****************************************************************************/
; _3 w5 Q: \- i9 i. O( q' D* o0 m6 q/ n0 b$ y
/* Unload Handler" }+ m4 }6 L: _
** This function specifies when to unload your application from Unigraphics.
; C3 L' h5 n1 u' `- z- W** If your application registers a callback (from a MenuScript item or a
/ \& n3 }# D$ l; ?* u! Y** User Defined Object for example), this function MUST return. f( r( U3 h% z( k
** "UF_UNLOAD_UG_TERMINATE". */0 m# }. g0 O+ H
extern int ufusr_ask_unload( void )' h+ ~8 k5 I4 k6 ?' F: [# s8 B( f" d/ d
{; @# h/ @3 v7 R T
return( UF_UNLOAD_IMMEDIATELY );; }$ v2 Z. l( ~2 \/ E% o
}. y+ y0 ]; j# j( s9 K$ W
& G3 l2 Y$ Q0 i& F% p }
/* PrintErrorMessage
w$ j3 E; M; q- n. k; t* E& N**
7 n* f% _0 I) D' W1 C& A+ @/ s** Prints error messages to standard error and the Unigraphics status! }- y, `" C% {' P' o- j
** line. */5 t6 l. L' E! m, w/ {5 O2 s
static void PrintErrorMessage( int errorCode ). _8 }: T( H: I* t! ~' W7 V& e
{" e6 B, P( Z2 U/ [3 P$ r* p
if ( 0 != errorCode )7 E) E8 n% b% R. n
{: j% D5 O. Y. V" O6 S
/* Retrieve the associated error message */5 f, n4 t- w: H* A/ [2 G) }' B
char message[133];
+ b+ _4 C) L% | UF_get_fail_message( errorCode, message );5 U r$ G% P) u* W8 E% `6 R
) C( H3 \ u) R* E% K+ o /* Print out the message */! U+ P, ^8 j& C: j% ?; F$ u
UF_UI_set_status( message );3 |1 t, w: O! I3 c3 a2 E
0 V9 l+ G/ _* j8 g
fprintf( stderr, "%s\n", message );+ \ V3 p7 [0 r
}- F% J7 n7 D: i5 i
}
( z, K: G, K6 g0 b以上代码编译之后显示% T+ S- z7 H' C/ t
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int
9 p: N5 \8 T! F9 ]( F0 j: n" C0 q4 gd:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
1 w( f' g6 X, M% L. D% r自己怎么都解决不了,不知道哪位大哥可以指点一下小弟
4 M9 W% A6 V# K: U: A; P- ^. @
# c6 M: i# F9 ]& W* ], _ |
|