|
|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>! q# o- n' q9 B4 ^: Z
#include <uf.h>" ~+ T' Y' ^& _3 p% ]3 f" \! m
#include <uf_ui.h>2 D; {2 F( f5 a$ N% S$ n
#include "UG_UI.h" {6 g4 C, ^+ o( k2 a. b7 _
#include <uf_mb.h>
5 R: Y0 R- f; T7 v' T, `9 X3 w) i#include "UG_UI_calculate_dialog.h"( _# R0 t% u9 M/ v, ~- k% t
: {( W. ~9 |' Z: ~0 D9 [/*****************************************************************************! w1 l! a5 Q% y' P0 Y5 Z7 K
** Activation Methods6 |* _$ M) Y* ^! B1 d
*****************************************************************************/
2 G' y _) N/ N8 b& x# Z! S2 |) `; O
Q/ b/ L9 P7 p0 d0 C/* Unigraphics Startup
8 F$ P; h- v) C+ ~+ b* ~" W2 N* P** This entry point activates the application at Unigraphics startup */# b; b1 n! [6 {
extern DllExport void ufsta( char *param, int *returnCode, int rlen )* }+ Q d4 z( v
{; o( ]6 f- P) J8 X9 M8 X0 U# h( H
/* Initialize the API environment */3 x7 p0 K% o( H& I! m% A3 j; c
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
8 k* S! T: I+ Z2 h) {: m5 ?8 f2 @ UF_MB_data_t,UF_MB_activated_button_p_t );
5 G1 b" b* p: Z) w static UF_MB_action_t actionTable[]=
$ q$ V$ h8 K$ H, g/ J. L$ O# H {% C& ]9 {6 n3 h) v# E8 }
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},$ c8 H5 Y9 @3 `# h9 Q
{NULL,NULL,NULL}- Z, y! X* x* | J! E- s
};1 [8 u- y% F" f: X; G y
int errorCode = UF_initialize();2 R1 G7 K1 c# z a) i$ v7 @, F# C
if ( 0 == errorCode )4 q! U4 P. B3 b6 }/ u5 Q, H
{2 D, X& ?8 Y+ ^% @7 t4 E- |5 F
UF_MB_add_actions(actionTable);, X& v+ \* i# Q% R
errorCode = UF_terminate();
! s" q' @/ R+ X; w: ^& t }
+ d5 o! n2 l& E+ [ u PrintErrorMessage( errorCode );6 q4 M- D7 {; ]! u) h1 z. f: J" h: T
}1 W8 g/ i7 e5 i2 D! d8 ?' {
) f/ Q- z/ U) Xstatic UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
4 R, |; n! o6 Y* n UF_MB_widget_t widget,7 G6 T7 S& b4 M" V
UF_MB_data_t client_data,& U% s4 ~* l+ r0 \
UF_MB_activated_button_p_t call_button' C( j; _( Z! L! v
)
" U) ?! U0 C; p8 i: z, w" Z8 v/ _, c{
. L; x/ b& B! S& w9 ?- W( k UG_UI_calculate_data m_data;0 a5 O) `# w5 [/ P1 o3 I/ w
int response;
- \( ~- o- ]/ w5 V* b LaunchCalculateDialog( &response ,&m_data);8 j$ _9 b/ t( E3 g0 P! w b$ Y
return UF_MB_CB_CONTINUE ;( f# Q9 g/ e7 \6 g) J( O
}
" m0 A- I# N+ S2 G/*****************************************************************************/ ?3 h4 e4 _: j, E; Z
** Utilities) D" B" W+ G+ J$ f5 u: d
*****************************************************************************/% w v, T9 v5 h2 m4 o
1 u1 g, J% K$ b/ m
/* Unload Handler
; t- X6 l+ q$ f$ ~** This function specifies when to unload your application from Unigraphics.: R) L0 W* {+ d; d$ Y1 J
** If your application registers a callback (from a MenuScript item or a
0 X1 G9 X& ?4 i9 z** User Defined Object for example), this function MUST return( |! H6 ?8 @, H
** "UF_UNLOAD_UG_TERMINATE". */. |: j" b \+ J8 z
extern int ufusr_ask_unload( void )5 N8 G" T$ d! j( I l
{* r; G0 a! o9 A0 T& q7 b0 U' |1 }
return( UF_UNLOAD_IMMEDIATELY );9 ~, z, P8 t; r
}
8 W. d" E6 G* c: F2 l: U
N% r) U* D. T/ H/* PrintErrorMessage5 a$ n7 P/ e$ t8 m* x$ }& N5 E1 ?5 c
** \: n' C8 z, J4 U, q
** Prints error messages to standard error and the Unigraphics status" Y" t. Q) Y! A) o8 @
** line. */4 @7 B; k: C5 V
static void PrintErrorMessage( int errorCode )/ i4 f; h3 R- c% z# a
{
, Y" v+ [+ `6 R& C$ g0 @" n if ( 0 != errorCode )
6 w& W0 n' X8 B" S# w) w |( O {
6 u& B: m# f! T& o/ }& a /* Retrieve the associated error message */
! P; G, ]3 T. F7 n: z# j" y* m char message[133];
, I! q3 V) n3 c6 s Y: U UF_get_fail_message( errorCode, message );4 R% f3 E" _* ~) z% W L
0 g9 x( s6 Q: O; M$ @) { /* Print out the message */8 n% o) a( r; H4 L- A7 t
UF_UI_set_status( message );8 g. @9 B2 v p3 O1 H+ }6 u# [! B
$ Y. E9 P& j& z6 c' X' { fprintf( stderr, "%s\n", message );
2 O; s9 l. h9 f+ C1 b }
/ p4 i' O4 e+ f6 p( R# D) Z}. x- J. }) ~3 G; a1 T- u1 ~
以上代码编译之后显示
9 D& y# C0 n( s- Dd:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int7 k9 m1 E0 g5 r+ w- e2 a b
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier# A( {8 ?/ ^, U
自己怎么都解决不了,不知道哪位大哥可以指点一下小弟
6 S. m7 j/ n4 g; K! H D' o8 z7 i1 g/ a& T( W! D. k9 b7 u# u
|
|