|
|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>
1 z$ s& M( z$ b3 e+ S( C2 Z#include <uf.h>9 l' U* Q- C$ K5 G& z+ ]+ a
#include <uf_ui.h> d4 Y& H' @' Y
#include "UG_UI.h"( N E, Y( \8 |2 S
#include <uf_mb.h>
+ `2 e7 s" d, i. T8 h* x1 q#include "UG_UI_calculate_dialog.h"
8 g! n7 i4 q8 j: \' O) t$ h# z
, W" ?2 n+ i2 J* ]0 W0 Z5 H/*****************************************************************************# {3 L3 o4 q: Y/ d- `
** Activation Methods7 d# e9 ?0 J# B" e
*****************************************************************************/! n$ r3 d( Q0 Y# p, z3 ^. ]* {
, y1 s4 j; U! }0 F
/* Unigraphics Startup
" u* S+ a1 z) [* X9 }2 {1 ^9 t** This entry point activates the application at Unigraphics startup */
, @6 C: M3 t0 v4 U5 textern DllExport void ufsta( char *param, int *returnCode, int rlen )( q' O& T4 \8 [
{
7 D$ R$ r4 J7 D# ~- q$ | [$ | /* Initialize the API environment */
. l9 A: a4 [$ [$ M9 ?1 h9 [ static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
' t9 J% b; h' q1 N1 j9 u UF_MB_data_t,UF_MB_activated_button_p_t );, Y$ B* x5 a1 `; U" Z. h( h, L. y. m
static UF_MB_action_t actionTable[]=: q# n) n/ @& G: I, O, A: M( H2 w
{# P8 [. B7 z3 V4 a' j/ f% K, }
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
5 i( P8 X! L: v6 q: _! J: r$ B {NULL,NULL,NULL}- F. [! y4 S" C. C
};2 r2 ~7 j( H! @# n4 l
int errorCode = UF_initialize();
% C# ?7 F/ a3 f( e6 u if ( 0 == errorCode ): v. M* S" N' N: ^- U) O2 i1 F
{
0 c6 a0 L" J2 P UF_MB_add_actions(actionTable);5 `! `: i' w4 R( X3 A& D
errorCode = UF_terminate();* P6 A+ k+ g' q; J& E4 R4 ?+ Z
}
. P/ D( u* z: k3 [1 f PrintErrorMessage( errorCode );% p$ A2 c8 D# f9 l- \" _
}
. n: n6 c" O5 ^. u( Q ]
7 V* b+ R# _# V- Tstatic UF_MB_cb_status_t UG_UI_Test_Dialog_fun(# u" V( U. c. x3 p9 k
UF_MB_widget_t widget,
1 E% w/ R4 B- _4 F4 R# y UF_MB_data_t client_data,
4 y$ l; X$ R9 T6 [; v5 d, S8 E* o) D UF_MB_activated_button_p_t call_button
" p5 M. s; t$ M; e1 Z: X" q; ?$ f )0 P" n0 I- a$ x8 \% C# V. ~5 V
{
% ?+ J! Z8 H/ A" b D UG_UI_calculate_data m_data;
" u. s$ i1 t8 R ~ _/ m int response;
6 C2 r j' y0 W! ?3 `$ h LaunchCalculateDialog( &response ,&m_data);) k- @) v0 [# V4 M
return UF_MB_CB_CONTINUE ;, R* t% T& ^7 J' V
}4 B. V. n0 w0 q/ i
/*****************************************************************************
, u! D0 I: ` u3 b% r7 J' F5 C. o** Utilities I6 `( g" r+ U8 J
*****************************************************************************/
8 u4 W" S0 R7 C0 A# X5 N- j
2 {2 j& b1 {5 P" ` ]/* Unload Handler
8 t" O9 r3 ]/ |. M8 i8 S1 g** This function specifies when to unload your application from Unigraphics.
, W; t B8 W5 Y: H9 x+ M9 a** If your application registers a callback (from a MenuScript item or a! |6 q% i* r) V2 g
** User Defined Object for example), this function MUST return$ u0 b" S% S. i2 z: U7 n
** "UF_UNLOAD_UG_TERMINATE". */
: M, W6 A2 h, l# b% x& uextern int ufusr_ask_unload( void )
% B2 V0 {. N. S! G& ~ [3 N6 [+ i{( Z a0 R [7 i8 N/ `/ e1 J
return( UF_UNLOAD_IMMEDIATELY );
8 a7 V4 p) O% K9 Y I' W0 X* l}
* N2 @4 h) n) Q1 X$ b- B: I. \% d
/* PrintErrorMessage
3 ~) y' @% t% L ^/ C S5 A**4 Y' [' r" g# X# Z: u
** Prints error messages to standard error and the Unigraphics status- V0 s* P V+ J
** line. */
' j s# o# U& N* j+ A/ t" e( Ustatic void PrintErrorMessage( int errorCode )
5 T" L, S# m4 o, M( B{
8 t4 u6 G6 e1 h: q if ( 0 != errorCode )
7 r9 ?/ N9 G$ [# J: _ {! _( x3 r& p( F4 \/ I
/* Retrieve the associated error message */
$ L" |* f( U8 {. [: y4 f! r4 W char message[133];' y& e& ]" E5 C% j2 n. @3 U/ l" _
UF_get_fail_message( errorCode, message );
# y5 M" I3 m3 p H8 R" O( k# D2 j
/* Print out the message */
$ Q) ~" P2 @ P9 H0 I0 {* h UF_UI_set_status( message );
) @1 o( h) `" g+ E0 [; d- f" ]4 Z( R5 P# y$ v
fprintf( stderr, "%s\n", message );# c% d/ c: Y& K# w, d+ @
}! q- H% {3 J% i" @
}
, F7 o8 \0 p9 J+ E以上代码编译之后显示6 h; O* F0 w5 d. j
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int
$ x! T) K3 m. z) K: F+ X8 [! v1 ^d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
; r! R) ]9 L) f, [自己怎么都解决不了,不知道哪位大哥可以指点一下小弟# B$ H' A6 F7 L' I R
$ Q+ g% w6 l" `% \5 f |
|