|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>% y" A* m* o D u+ @$ [) y
#include <uf.h>- r! l' V* B0 E
#include <uf_ui.h>
5 \. ^1 d# {- D& j6 @0 E#include "UG_UI.h"
) r7 `0 ]' D+ [% Q* P# p#include <uf_mb.h>3 a3 F r4 b* `5 t6 V8 ]
#include "UG_UI_calculate_dialog.h"% k$ U9 a5 r$ d
& j) q# j7 _" {2 T! V! h/*****************************************************************************
0 C3 ~% L+ g& w+ ~: I2 [) N** Activation Methods' q' ~2 j6 }2 ?/ e6 x& ^5 V* g, s& E3 }
*****************************************************************************/
' q5 w8 h: g; G3 \* g' V- t" U3 _- |& Z5 D( q9 u
/* Unigraphics Startup( l( `( B5 t( p* w7 H6 p
** This entry point activates the application at Unigraphics startup */
) \- V* t+ p0 gextern DllExport void ufsta( char *param, int *returnCode, int rlen )8 X. { {! Z! z+ }% X
{
0 e. f9 g4 A: W9 R /* Initialize the API environment */# I* y( c& {. T+ z
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,. \2 V! D- d& b2 Y# _
UF_MB_data_t,UF_MB_activated_button_p_t );
0 e/ V! F0 s9 e! o0 t" x static UF_MB_action_t actionTable[]=) D2 Q; r1 X9 T0 U* L" e
{
$ T8 U u( q4 P/ q1 ~ {"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
/ w* J9 n! v1 ?" z% Q P6 Q, c {NULL,NULL,NULL}
; v. f9 V* s$ h. {7 V2 A/ g2 d };
8 f' D4 z+ z0 e! H& \3 r int errorCode = UF_initialize();; O R& L( E( y. x# b+ {
if ( 0 == errorCode )+ A7 {4 M9 |0 R J
{
& I. e# u7 {. c9 f/ {" d7 l UF_MB_add_actions(actionTable);
/ g: V: y: X5 p( u6 C errorCode = UF_terminate();& ?* D+ P; ?6 ?/ E. l! A
}5 @- s3 j: X. Q7 b
PrintErrorMessage( errorCode );; T: j3 B: ^' T
}
b) l, o T# O5 i) ?- e! U; W( V
* ^3 ]7 _0 S" D, @ v `1 _: Gstatic UF_MB_cb_status_t UG_UI_Test_Dialog_fun(' c& p5 u' l/ g; X4 Z# h( _
UF_MB_widget_t widget,3 T* b0 d5 ?' k+ G" U- n- f& k: w( }
UF_MB_data_t client_data,
1 p$ r# o7 B1 F1 A! n: g UF_MB_activated_button_p_t call_button5 o/ e4 o% G& p4 l/ I
)# K/ M! [# ~) E
{$ g! ?8 {* `" l* Q: ^
UG_UI_calculate_data m_data;8 J' u1 A( t& U" E; ~3 G7 p/ d
int response;
) | J' p/ q) X1 O* Q$ ^4 e+ H2 G LaunchCalculateDialog( &response ,&m_data);
% M: |6 H) X3 p return UF_MB_CB_CONTINUE ;1 q' P0 ~3 [1 {& m
}
/ l# r2 t; r+ o7 b1 n: v' D/*****************************************************************************
: d9 ~; s6 |' ^& ^** Utilities
) u5 F9 q" e- J Y# S x' d*****************************************************************************/
1 m5 u% q$ E* }' K9 X9 t1 N& x3 i
/* Unload Handler, d/ I& i, _% H
** This function specifies when to unload your application from Unigraphics.( e3 C; e8 p, @2 V" \# ?( b! ^
** If your application registers a callback (from a MenuScript item or a4 q. `' M8 J. c
** User Defined Object for example), this function MUST return* l @ q! Q+ {# g& Q
** "UF_UNLOAD_UG_TERMINATE". */% Q8 ~; _- |# ]! U1 J/ J( w! ]) p( v
extern int ufusr_ask_unload( void )
; M4 O: M: a8 i{" n7 ~$ M {# |7 T2 l- m. n1 W
return( UF_UNLOAD_IMMEDIATELY );, J$ U8 }) |! l% |8 m- D
}. ?" y' \, t/ x% H
; F. L" Y, Z; b! b. l2 o& z# g; e/* PrintErrorMessage
/ L$ ]- c( P5 C# D9 J**
# v7 z0 a! t: g** Prints error messages to standard error and the Unigraphics status' h) L3 ^) H" V. J( T
** line. */* I$ l: G; R* Z9 c6 ?* O z
static void PrintErrorMessage( int errorCode ). g2 b- q: L+ \
{
+ r! C$ a9 z7 H& \ if ( 0 != errorCode )* s6 E8 F# G+ P Y3 M
{- Q4 p; B6 D: N5 ~. ~
/* Retrieve the associated error message */
4 D! y) d" a2 I6 o char message[133];
& ]; H. A/ @6 W% a9 [% c UF_get_fail_message( errorCode, message );1 a/ S7 y$ R7 r9 M1 m8 p
3 s0 b- P! j2 U /* Print out the message */
) k+ x& W; N6 Q3 x UF_UI_set_status( message );; `5 c p0 l, L* U! X: B: D3 l
5 Z0 L" }2 ^- F& c5 t
fprintf( stderr, "%s\n", message );# p* J9 A* b4 Q% L H
}
/ s+ B; I0 a6 k5 S% T}/ J# v, j7 A$ s6 M/ T
以上代码编译之后显示) v9 ]2 u, j* S
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int
+ B( r$ b m' U: _6 od:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier/ g$ ?, \2 O# ~. V" H# M/ ~, W4 w
自己怎么都解决不了,不知道哪位大哥可以指点一下小弟
$ s0 ]1 _6 H1 u
) H. n1 G9 V& ]' U/ b% e4 ^ |
|