|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>: X) _3 {7 O$ D; [3 d0 I/ S
#include <uf.h>
# e, f" `7 a1 u: ^2 R+ @2 ~4 R#include <uf_ui.h>: L, n- E8 |3 p7 g/ D" R
#include "UG_UI.h"3 z1 @5 t7 F/ N- T0 }
#include <uf_mb.h>
t# U) q1 T$ @9 G1 K#include "UG_UI_calculate_dialog.h"
5 q) p: f& s! X/ @
0 N0 _0 C2 v3 E9 d2 Q/*****************************************************************************+ K6 E5 _3 L4 J y3 a6 y2 A
** Activation Methods$ l0 z1 S5 p5 I4 h6 E* P/ S9 q
*****************************************************************************/
1 D4 q1 u" ~3 N" L7 w( d
' z' u3 l- ^4 C- N% N6 u/* Unigraphics Startup
! l9 K8 _2 h7 L; |& Z** This entry point activates the application at Unigraphics startup */
+ r0 Q; l# c( D* b, Sextern DllExport void ufsta( char *param, int *returnCode, int rlen ) ]0 C O6 y6 W2 R4 r
{
f+ j* v" w# v& I3 @$ r' l$ C/ C /* Initialize the API environment */% a8 a. K) V4 K- I
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
6 e1 U( M+ i- g- L1 b; b UF_MB_data_t,UF_MB_activated_button_p_t );( M7 j' g2 {; H% x9 Q, e
static UF_MB_action_t actionTable[]=, ]- x6 ~1 m9 \
{5 p' W9 f& _* g2 s% @
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
! d# D6 P9 v( _% b {NULL,NULL,NULL}
6 ]% f+ b9 y% x# S } };
1 I$ J+ E1 O | int errorCode = UF_initialize();1 f. b1 C: N1 b! x" O
if ( 0 == errorCode )
9 [" U1 l* t) T: a5 C! ] {6 i" s }) U0 ]- i
UF_MB_add_actions(actionTable);4 J! ^( }8 n5 M5 b/ ]
errorCode = UF_terminate();
* `: k5 x& }9 d7 R }
( G: ]; F4 j" D PrintErrorMessage( errorCode );3 c# t+ y+ B# n
}( K4 ] {( p: B/ |+ x, ^
% s: R; X4 d6 X0 o# X9 K0 P4 x
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(5 W; E: v% ]& M$ |! }! n! ~
UF_MB_widget_t widget,
0 b+ g* `; B( f UF_MB_data_t client_data,
8 m( B" M/ t3 f n0 y UF_MB_activated_button_p_t call_button1 O' R' g$ s: A6 s# z
)0 D$ W- m7 T+ O2 K
{9 l- D, L0 a/ h5 T$ t
UG_UI_calculate_data m_data;# d& I M0 A/ ^6 r# `1 i: V7 ^
int response;
# R. M/ P* C$ W0 i LaunchCalculateDialog( &response ,&m_data);
6 K U0 S5 P) ~- R' b return UF_MB_CB_CONTINUE ;- N9 t! l8 ~6 R9 M7 t# w
}# `6 I6 B& Q8 m
/*****************************************************************************! {# C/ y5 z( a! q/ ?. L
** Utilities9 C& T( \, B( H: F
*****************************************************************************/: ?; W- V$ i9 Z8 Y! \, t
( J) I: _! P2 ]# w- Q3 m) A
/* Unload Handler
' ]* Y2 z- c' k: R) k8 E F** This function specifies when to unload your application from Unigraphics.) T5 r2 j* D" w0 Q/ ^* c! Q
** If your application registers a callback (from a MenuScript item or a
! U/ D! N$ L' ^$ R0 M- Y** User Defined Object for example), this function MUST return0 B# [ ^1 y& m8 u& E! K1 F
** "UF_UNLOAD_UG_TERMINATE". */# F! z7 b) Y" F4 _0 l+ t# `$ w
extern int ufusr_ask_unload( void )
, l0 D$ Y) z" c2 k& J7 m: ]( W{
6 t2 w+ _; e' z3 u9 [8 f' j1 Y return( UF_UNLOAD_IMMEDIATELY );
3 x( g2 }, R7 C% Q# ~}
2 t8 I+ `. ^6 S3 l
9 x x( K0 s$ E! u `4 ~% t1 u/* PrintErrorMessage
1 M5 a& x. L6 L4 s4 n6 ~$ a**
6 h% d* U, N# m+ Z* T+ `** Prints error messages to standard error and the Unigraphics status
5 ? x+ e0 j, U/ u** line. */( w* l' W' q! b8 _- [9 D! k
static void PrintErrorMessage( int errorCode )) j- h2 K% W) |% N3 G! i5 q
{
5 \" R1 }2 X8 o! T. M if ( 0 != errorCode )
) q9 e, u3 I8 q4 w {/ L3 {3 P2 g# T& u0 B( E
/* Retrieve the associated error message */
' j! G. P: N+ J( m! ]9 p3 V9 Q char message[133];
( C. V5 f' v: _" P UF_get_fail_message( errorCode, message );- L( D0 F& J Q
V3 u0 _+ V' s4 U
/* Print out the message */
) E6 ?6 R$ v) r9 T UF_UI_set_status( message );
2 A: C2 A# Q" g+ H% v0 b- b1 ^ a: u/ I& e# V$ J* f [
fprintf( stderr, "%s\n", message );
% ?3 B4 y7 O% c }/ U6 ]8 |% D% |
}
) t$ u/ [3 H5 y- u' C6 i以上代码编译之后显示$ s9 a6 E2 X. x* X
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int5 x) l. S0 d" P# p# y/ e
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
@( I$ w: i! P& O自己怎么都解决不了,不知道哪位大哥可以指点一下小弟
2 y! u) e( e( j7 |: u
. h* q% x2 D q: U. h |
|