|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>
& I( f L& `& n# [#include <uf.h>
& ~! b; w* D2 g#include <uf_ui.h>% y6 Q8 G7 ?$ d. l) m ?1 |! W7 [; w
#include "UG_UI.h"
; j: D+ h" l, b6 |# m" Q3 }6 ^#include <uf_mb.h>7 B* z# u6 R+ f
#include "UG_UI_calculate_dialog.h"
( j: G* H: h, Q- Q, o1 O+ b5 f% x) c Z+ S1 M) i
/*****************************************************************************7 a9 o, e5 @! l5 B
** Activation Methods
5 w2 e6 l- `* o( Y*****************************************************************************/2 Y2 r: S2 r+ T) Z3 j* P
3 A$ r" l* k2 d$ V! X& v
/* Unigraphics Startup! `2 b% v2 s! M5 k! G; X2 B
** This entry point activates the application at Unigraphics startup */9 a' ^( Z' t/ |
extern DllExport void ufsta( char *param, int *returnCode, int rlen )
# N* {) o5 m% x) e9 \{
! T" d; F2 @/ P [0 [0 o /* Initialize the API environment */
6 J1 g1 d- \4 P( t7 Y S5 J static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
3 Y: i' T, U6 b1 y1 m UF_MB_data_t,UF_MB_activated_button_p_t );
. Q) Z; @* I, L/ }/ m0 T static UF_MB_action_t actionTable[]=
' M# {5 w5 _% f1 a* B& [ {" J. _7 P0 y. h3 U% R2 K
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
( e/ w( _8 O: K {NULL,NULL,NULL}
+ ], W8 U2 `5 C8 a ` };9 b3 \/ W9 A8 C, a
int errorCode = UF_initialize();
( e/ c- j+ \" V! M if ( 0 == errorCode )
6 ?; k7 }) T6 ^/ e( L: _ {6 x# j& B1 H* j* C+ {) `
UF_MB_add_actions(actionTable);7 C/ Q9 q) i0 ^- T) Y( u. i; q, d9 n
errorCode = UF_terminate();1 g+ m0 V0 _# L! S3 P
}
, y" l5 T9 X5 O7 v g PrintErrorMessage( errorCode );& E% C9 U! N' d
}" u7 U" Q0 T7 T8 A y0 M. }+ E7 L
1 j" a- s! [; v1 ^! ~0 Estatic UF_MB_cb_status_t UG_UI_Test_Dialog_fun(& T7 t, F2 S; F0 P+ k* G( A
UF_MB_widget_t widget,) y" ]4 w% [5 W6 i7 {1 M
UF_MB_data_t client_data," \+ {! W- `" J7 M8 i
UF_MB_activated_button_p_t call_button
! J" M& h1 Q- I+ G )
7 A% K3 q. u! y' g* q3 w$ K{ B$ R3 H# U- T( C4 m
UG_UI_calculate_data m_data;$ d" B# s# v. b) x9 Z
int response;% S& K3 Q; B5 `
LaunchCalculateDialog( &response ,&m_data);1 z* U8 L I4 i) ~& y& ]
return UF_MB_CB_CONTINUE ;) H: ?% g) |+ o
}
9 n/ y, |1 n5 W% c. V/****************************************************************************** q) ^# e8 u- T. P7 Y5 W
** Utilities" s& A3 [' S7 V0 ^" P- `4 U
*****************************************************************************/
$ m6 {* h5 S: {# H+ C! E
: W* a% D' d7 g ]5 q( C( N/* Unload Handler$ e) T/ M8 G9 A8 I
** This function specifies when to unload your application from Unigraphics.
" t; |4 a, z' b1 G** If your application registers a callback (from a MenuScript item or a
$ T5 G- f7 k) E& \3 D2 w R** User Defined Object for example), this function MUST return
- Y( U0 i5 k* I: B; Z** "UF_UNLOAD_UG_TERMINATE". */
" u1 `/ f f9 j# B# }8 e$ C" Bextern int ufusr_ask_unload( void )2 I$ H2 E6 B" Z6 Y
{
; |4 y5 @ o+ o. ]3 }) V( f6 W, w return( UF_UNLOAD_IMMEDIATELY );& L' T+ P4 [& A" z
}
- j+ x+ m+ g- q- G. d: M& A
1 s( D& I4 s, @( }$ W2 R/* PrintErrorMessage
: |0 Z2 D* D- q# w+ Q" ]$ x6 L h& d**$ \6 a( `+ z# r9 V9 M" n
** Prints error messages to standard error and the Unigraphics status& \, f0 H1 l. v* f
** line. */
: g' N+ n$ {* k* d% s( Fstatic void PrintErrorMessage( int errorCode )
7 I2 S! K* o/ Q. p* A{( q' S7 P( Y7 \* L* `% ?- B
if ( 0 != errorCode )
# _8 E1 b* ^: W9 t# ~/ m {: y8 S/ j- r' V4 Q
/* Retrieve the associated error message */! t# e6 D) o0 t( L. `
char message[133];4 m9 R/ s" l# Q: @2 ]) T, J
UF_get_fail_message( errorCode, message );
1 B# v) k: }" W# t6 r
* {* `) f! E3 O /* Print out the message */
& _3 z5 r8 k) g' z2 e; p UF_UI_set_status( message );
! B' k8 ?2 S5 h' I+ ~# M8 u1 T) V
9 P+ k# e/ @2 b$ m1 n( f- k- } Y fprintf( stderr, "%s\n", message );
; T: w' }4 P1 _$ j }
0 L1 t7 l, X: Y( Z$ o}
4 J% {$ n& l) M以上代码编译之后显示
- f( i8 t( R; Id:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int5 G/ }' Z5 U4 I: s9 R+ Z& b2 w
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier/ k, t% `1 N1 |) x9 `5 u* _
自己怎么都解决不了,不知道哪位大哥可以指点一下小弟( J: W) h- j" ]* v0 C
) f7 T! o4 r8 W! U$ O3 H
|
|