|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>
9 A4 l b1 S! S4 E8 w#include <uf.h>' Y8 y5 C6 Y* u! F, p4 R0 E
#include <uf_ui.h>
( B" _! n ?: A8 `. ~$ D#include "UG_UI.h" q7 M3 V m0 a& a- Z1 s7 K; |
#include <uf_mb.h>. z2 d! L r' w( L- _/ c y8 p
#include "UG_UI_calculate_dialog.h"3 y3 O( J, G" o
) j/ {& t% }0 \6 E& j, x" D4 h/*****************************************************************************( _1 m: J& O3 y+ @5 y9 _% V
** Activation Methods
( z7 a8 `1 X; p$ m9 \/ ]*****************************************************************************/% v9 S$ t, j- W& C8 z8 V
0 ^& E: U" E3 P: V- D+ C$ w/* Unigraphics Startup' D x4 x7 d7 f
** This entry point activates the application at Unigraphics startup */6 {+ k+ X$ c' ^- A. f/ W. Y
extern DllExport void ufsta( char *param, int *returnCode, int rlen )
% N' Q+ L+ i# r{
: g$ I: [+ A' \* ^* u /* Initialize the API environment */4 X. H- g! q% I" ~- x4 _
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,% d% u7 J& s% `4 S: {" }
UF_MB_data_t,UF_MB_activated_button_p_t );" u8 I+ Z" Y# {
static UF_MB_action_t actionTable[]=8 K4 i4 D- K/ z" i5 `
{5 X/ ^, b' w6 Q' X- P' N" _( Z
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},, W2 u1 D; E# d
{NULL,NULL,NULL}
0 f2 S$ |) l; ^: B3 |- M3 G };
; y$ _8 x4 V. ~ int errorCode = UF_initialize();
& G& R$ h% E8 n! B if ( 0 == errorCode )) @! D3 ~ y! [( H) Q
{- @& p- W8 R) H* s+ y8 h
UF_MB_add_actions(actionTable);
. v* o5 Z/ Z9 z$ E errorCode = UF_terminate();5 ?5 Q) O3 M: Y& W
}
$ s+ H6 P% E S: B# X3 T PrintErrorMessage( errorCode );9 l4 |& o7 Q! C- o5 k
}
) v: p9 @+ m& [6 O+ u4 x! h
" ]" b" k0 ?* Y @3 Y L! _ vstatic UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
) o6 E1 m; ?1 x( A/ ~3 c UF_MB_widget_t widget,+ t9 }, J' C* F' _) r4 |! F
UF_MB_data_t client_data,* y- B5 w. `" M) w
UF_MB_activated_button_p_t call_button8 f' T! O$ `- k. N* N& u/ j' p
)# i, g0 n% N+ _& S0 w
{# f7 b1 k s2 f8 h& v0 P
UG_UI_calculate_data m_data;* _+ e6 z! Z% }! M+ e
int response;
1 D8 ?5 S8 `2 a& n7 Q0 m0 z' ]9 ? LaunchCalculateDialog( &response ,&m_data);# u! ?. B8 y z+ R% {7 e& A2 c
return UF_MB_CB_CONTINUE ;
5 b& h" e% e8 Q- P5 d}
: _' j4 Z9 }5 S6 m" L/*****************************************************************************) n7 c& o8 m" H3 K
** Utilities4 F2 L) u ^, j0 q
*****************************************************************************/, F# r' }; n( r" {& T5 o+ E B$ L
1 @1 w: Z9 V. Y! f* W/* Unload Handler% V( I n/ P. d
** This function specifies when to unload your application from Unigraphics.
3 I9 e" h; ]- x& `3 O# h** If your application registers a callback (from a MenuScript item or a. Q) K1 |: |7 \1 g6 A
** User Defined Object for example), this function MUST return
% j$ L; s8 J |/ K; U# I4 ~5 a g** "UF_UNLOAD_UG_TERMINATE". */4 \$ K: E: O( Z, t3 B% p- [
extern int ufusr_ask_unload( void )+ P q1 K; C0 y, A
{4 S1 w3 m; G& A/ g4 F" [1 u
return( UF_UNLOAD_IMMEDIATELY );
5 W1 H# l$ k. E9 M+ _& Y2 d- b}
" Z$ L* C: r- c- `" O0 l
; ^4 r [) X/ y& j& C/ N/* PrintErrorMessage# I7 X9 ?: ? x+ Y
**
' M1 e$ L5 A+ i7 [5 X: s** Prints error messages to standard error and the Unigraphics status
* T+ {8 H1 M# ?0 C7 o$ w) K** line. */
0 ^. Z6 {$ Q+ dstatic void PrintErrorMessage( int errorCode )
7 U( s4 d: H) H6 @5 b* n{
1 Z& B# H) B, R+ C* j, l& g5 K r if ( 0 != errorCode )
1 v. n$ A1 U, t {! u. c9 b" H1 N" ^: t
/* Retrieve the associated error message */
+ N+ N' P# j1 R) @* E char message[133];5 A6 d# Q9 c1 K1 v, F
UF_get_fail_message( errorCode, message );
- Z1 H; K+ g9 D3 _
5 y$ q9 C2 [% M4 O4 D5 l /* Print out the message */
5 j' f! x( R; G# k UF_UI_set_status( message );# d$ H8 ~& w8 J5 f+ ]4 _& @! r/ ]3 W8 s
0 G1 L* f4 J+ M. {* H8 q, Y
fprintf( stderr, "%s\n", message );, k- H" j) D( P! E2 S( T/ G
}
- W p/ U+ G+ @- L" n, X}
5 @5 o, H/ i: R9 ?以上代码编译之后显示4 V* N$ Q. C2 Y. a3 l
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int0 r0 N0 u$ P: \6 [
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier B/ ]# i# q: D8 }5 K3 o
自己怎么都解决不了,不知道哪位大哥可以指点一下小弟 s" v& d j# w) E8 R8 X: ^' k8 e
1 Q; K% M6 s4 {3 j
|
|