|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>0 n, f4 K6 ^: B8 ^
#include <uf.h>. _4 T$ l w* Y/ s+ `
#include <uf_ui.h>% a( H, r$ ^& S2 c' | N
#include "UG_UI.h"' Q. S8 X0 J. G7 X ^7 U
#include <uf_mb.h>
; i, u! U( c8 r+ l- x- `#include "UG_UI_calculate_dialog.h"3 U2 `1 e; w l' E
7 ^( {+ i; ]/ v5 ?$ k8 x& s& l, V
/****************************************************************************** h# f9 }; H' I5 y, ]% W
** Activation Methods( P8 {, `' f* j" c8 ^# z
*****************************************************************************/
$ A) j/ n8 ` Z1 @7 X. g/ X; R9 b0 x- T( C
/* Unigraphics Startup+ Q" T \5 @* ~. M5 O8 k+ j
** This entry point activates the application at Unigraphics startup */8 ^, j/ [0 r1 v
extern DllExport void ufsta( char *param, int *returnCode, int rlen )
* S# x( U5 K3 `{
3 P7 {7 Z+ g, B+ H9 K& @- B( i3 f /* Initialize the API environment */
6 [! @$ }5 Q6 ^3 h static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
1 s% }7 o4 B7 \: ~. L9 D UF_MB_data_t,UF_MB_activated_button_p_t );
. { \, l: |8 i, W$ K) t) F static UF_MB_action_t actionTable[]=2 o* ]/ O, f$ G4 D! `; j
{: s" F; a: E4 F" a& F
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},+ i t% W) @4 v+ P" j# w
{NULL,NULL,NULL}2 U; R; P% o$ ]( H7 \
};& \6 _7 ~5 H/ Y
int errorCode = UF_initialize();
( N X9 |- ]. e5 h* X& \1 v if ( 0 == errorCode )6 Q# `$ ^0 {6 U- U$ ]% @7 C. `* u, D
{9 l7 h0 b0 L2 m N7 @' G/ Q
UF_MB_add_actions(actionTable);
# m# w9 i/ t* y$ k errorCode = UF_terminate();) g+ o: E5 O% s' h2 g, m6 {% ?& l
}8 g1 K- X2 [# O4 i) f
PrintErrorMessage( errorCode );6 {5 e" R% X; t- K1 L# a6 ~/ G
}3 y/ U9 }) E a+ r
% [6 b* s$ Y4 I5 l+ P3 U
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
6 l( t7 b# S! E7 M2 O, ? UF_MB_widget_t widget,
# h1 p" `. B+ v# y8 ^ UF_MB_data_t client_data,3 ?1 b0 i( ]8 ]1 Y. f
UF_MB_activated_button_p_t call_button6 [5 c* q* l h8 s7 L
)) a, P) C8 [! j% k7 Y0 K
{
4 `; f2 ]' ?6 F' {0 m& I! C2 W UG_UI_calculate_data m_data;
1 o# ^% m. _3 H9 ~2 E$ J! l int response;7 V p4 D% w# R. w7 D' o
LaunchCalculateDialog( &response ,&m_data);
9 H/ ]- @' j8 X7 ~8 Z4 N) Q2 ?# J return UF_MB_CB_CONTINUE ;
* e3 c, p% h- c( k1 ?}$ Y1 p( g" r/ w0 t4 I G; ~0 n
/*****************************************************************************7 Y* u# q% ^$ W/ Z: r6 Z* ?
** Utilities: I: h6 w1 h0 T9 O7 v& r
*****************************************************************************/' x4 ?2 Y( k/ O/ u' r1 @2 |$ \+ _+ g
8 j+ |9 i4 n4 m; c* ] d
/* Unload Handler
0 } R. a$ l! h5 h$ r** This function specifies when to unload your application from Unigraphics.
5 m0 e% Q5 d, K: r7 v** If your application registers a callback (from a MenuScript item or a
* h5 t: j7 M; x8 u5 t# H/ h+ |/ P$ O** User Defined Object for example), this function MUST return$ C9 G; `+ f, h' }! |! {
** "UF_UNLOAD_UG_TERMINATE". */
1 d+ W& _' Z* L/ g2 Y% T" pextern int ufusr_ask_unload( void )1 b0 Y5 [# B) ]
{1 u; k" `6 i1 y# @; u6 D# M$ y
return( UF_UNLOAD_IMMEDIATELY );
5 a, A6 j2 x1 C+ ?7 \}
5 e B5 Q. t1 u; |" d" p. |8 p! Y' p& t
/* PrintErrorMessage
. J# R% B! z1 y) d& o) x. {% K**
$ p* X* U: V9 ^+ o+ g2 u1 E$ R** Prints error messages to standard error and the Unigraphics status
! C) r3 A5 H9 {( b0 L+ W1 N/ U** line. */2 _4 a4 V, C, p% R5 o9 @$ }/ _
static void PrintErrorMessage( int errorCode )% f/ [; P" W5 ~# d7 P% x% L0 @
{# r" z& O2 P. B9 I3 \1 f
if ( 0 != errorCode )
$ ^% g; W5 C K# k& J4 V {
9 n ]( F2 u# c8 q4 X" [% Q /* Retrieve the associated error message */3 _& P E* h( y9 b0 R
char message[133];
" F& |4 W% ^ ~! }1 u UF_get_fail_message( errorCode, message );
/ |8 c1 |/ Z. ?2 z, a8 n1 c. [2 B4 \! ?
/* Print out the message */
$ j7 r, r8 u5 I0 | UF_UI_set_status( message );
9 p6 f% \6 c/ U9 t, ?/ K. Y. u I- G( A
8 ?$ ]+ k; x+ D* Z0 v# F" G7 s7 m& I% g fprintf( stderr, "%s\n", message );# d6 e4 y6 u9 {/ }) Z
}
4 e& z8 {) ^7 Q ]/ k$ V}
8 o7 W `$ B8 [' I5 e) _# L以上代码编译之后显示
' R4 f' K& @. Jd:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int
' P( e7 `5 j8 }. p+ ^d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
4 v4 b- r" U; m9 J自己怎么都解决不了,不知道哪位大哥可以指点一下小弟
) p) |) e, t' t& c- Z: {
( P9 Q: [# C/ {+ u$ ?6 x1 @) p |
|