|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>
8 T0 k+ a: W9 \, r#include <uf.h>- m& E0 m1 W2 k
#include <uf_ui.h>( K; V7 D9 m' v' v
#include "UG_UI.h"
- U7 q% t, e$ C! \) p6 [#include <uf_mb.h>9 V) \$ X& t0 F( h5 `' R- `# X
#include "UG_UI_calculate_dialog.h"8 Z4 p' R8 a" U
# T) k4 v& ~. W V. e8 _/ h
/*****************************************************************************2 t, T* j' @! I/ A
** Activation Methods' h( X5 s9 j e: v- A
*****************************************************************************/1 I8 A% p+ ]$ p2 s8 m, s& b4 L' C
5 y. D" i0 ^+ D5 t# Z% z* ]( B% H/* Unigraphics Startup! ~( e8 X6 E. P2 T4 f- j4 B
** This entry point activates the application at Unigraphics startup */: Y: _6 i. `$ D) H7 k, b. R5 l
extern DllExport void ufsta( char *param, int *returnCode, int rlen ); D8 R+ @" H/ {. s, f3 R) [; g
{6 z% ?2 M$ r: E
/* Initialize the API environment */
) M/ B& S$ _5 F7 `$ A6 V static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,7 l5 P$ _3 c/ ^" t. ]' f$ h+ S
UF_MB_data_t,UF_MB_activated_button_p_t );3 A/ X q( {9 o* L, L9 K; K$ B
static UF_MB_action_t actionTable[]= L ^, C- U# d. A
{/ }' U* Z0 Z. u) g9 j1 B2 N1 x
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},9 i# Z8 H' t) j* E% N
{NULL,NULL,NULL}% I* k2 L5 u& W' G5 W
};
; i( I* t2 F: t N- { int errorCode = UF_initialize();
: ^$ z3 D4 X! N5 z6 o) R- d8 \) u if ( 0 == errorCode )- _* l" k. L. }- ~
{
- h) r1 Z8 K; D5 J UF_MB_add_actions(actionTable);' l$ Q9 h9 a0 d5 d- N) n5 R
errorCode = UF_terminate();
6 k4 }( ^2 f+ i4 }# ]/ N }( K7 A0 E" N" E P9 O+ {3 _
PrintErrorMessage( errorCode );
( I$ Y1 g) W% t8 n. u5 E5 I}- e8 {- `% I8 L1 I4 _' Q
2 G# Z/ m. A" r' q4 x7 w" t' `static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(& D# A" }+ a1 s
UF_MB_widget_t widget,7 D- d2 g1 y( I w; a& e! [ Y
UF_MB_data_t client_data,2 G# I0 B. l8 ^# E1 z9 I: f5 U/ Z& d
UF_MB_activated_button_p_t call_button* V1 E/ d& ]2 ]( [
)7 M1 O$ ~+ }' J) C( r
{
" O4 S* b; P: O% Q7 e( b UG_UI_calculate_data m_data;( M0 e" {- {) ]6 O A" F
int response;
9 I I% d2 a% M* ^. m; j LaunchCalculateDialog( &response ,&m_data);; Y/ f5 z4 V+ X+ @
return UF_MB_CB_CONTINUE ;
: t6 S5 g2 j+ i* v- ^# Y}
9 g: c1 q# L8 C. t9 ?/*****************************************************************************
. j* x) W i1 Y" a3 [; @** Utilities
4 A1 r) ]; x( P* E*****************************************************************************/
% e* f, @; C V' _$ u! H* X5 A# [8 n$ S, k4 D' u
/* Unload Handler4 j* k* G P, n
** This function specifies when to unload your application from Unigraphics.
+ `/ S" q$ z- i8 j, [. p" ^** If your application registers a callback (from a MenuScript item or a
4 }0 l X4 r" X6 \- K$ [8 T I- I** User Defined Object for example), this function MUST return- Z' Z: k. I4 s' ~, x. _
** "UF_UNLOAD_UG_TERMINATE". */
( e7 N) ~' T3 a/ _( h+ @6 Z. s& B" F# wextern int ufusr_ask_unload( void )7 N9 e! z; u! c0 i
{3 C) l9 a5 l- n1 d) Y. R- s$ _
return( UF_UNLOAD_IMMEDIATELY );
) K( }1 _5 x' U$ r1 Y4 `}
& y5 b9 ^+ e# d- R8 G1 b! n% K; x/ `1 G6 K. l7 r
/* PrintErrorMessage
) s0 D8 m; g$ e& ~% z**
5 Y) Y7 s) A/ k- c) d7 m0 j** Prints error messages to standard error and the Unigraphics status4 ]+ O& X D! y7 Z& }# S% _
** line. */9 r) ]2 g j# Z' `$ m
static void PrintErrorMessage( int errorCode )& l( s. S6 ]4 {4 x! C8 f
{
; ~3 W8 f2 _6 \& x6 v- p if ( 0 != errorCode )6 @2 R5 G; \: [1 n3 @( j6 H
{
) h* L. p! I. Y9 R* z% |- n' } /* Retrieve the associated error message */$ T7 S/ M' _& {
char message[133];! g' O8 m% S4 \ H9 M
UF_get_fail_message( errorCode, message );
* g% T% [, \, O6 Z# m+ _( N) Q+ w/ u* K3 J9 h- h
/* Print out the message */6 R+ B0 L& C/ M! J& ]! P
UF_UI_set_status( message );
2 j9 [ `$ \* a
- s/ W; O a9 n" O# R4 l# T fprintf( stderr, "%s\n", message );' X3 ]9 m3 E7 D- t4 P! a8 c; C
}
$ [0 E3 A0 [" X" g% ^}' N3 x) X; E& B- Y' L8 V6 h
以上代码编译之后显示
5 A6 u8 s' v! f; W4 Rd:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int/ ^( U' f, A Q8 N
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
. `, ?# @' K# I' ?( \6 c自己怎么都解决不了,不知道哪位大哥可以指点一下小弟
/ n% U# \1 {8 J* E+ H/ N% Z8 h- i9 E
7 Z7 x- I ~, o' _ i& V |
|