|
|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>& g2 S5 J, n# p) s L
#include <uf.h>
) ^0 H! G4 W( d: h- n' D# { A$ D#include <uf_ui.h>
# n2 g) g; I+ w: M6 g6 M#include "UG_UI.h"
& C, K& u# M+ a( g5 ^#include <uf_mb.h>
% l( l. d2 e! U" z8 C# a#include "UG_UI_calculate_dialog.h"- J) c$ R. Y: T. x Q
) ~( _( T9 s, R
/*****************************************************************************
) ?5 B% D0 i% [, y** Activation Methods8 B7 ^7 {" y9 }. r
*****************************************************************************/
, B4 u; w b& n" ^, ?4 E# J; }" J R3 X
8 e; N0 H8 `0 E: f' ~2 [8 G( L N$ n/* Unigraphics Startup9 L& b6 Q) j. {+ e
** This entry point activates the application at Unigraphics startup */
5 ?6 t" a0 ~7 P5 y* j" i- d) jextern DllExport void ufsta( char *param, int *returnCode, int rlen )
' T6 M5 H7 D( f) _0 N7 U. m{3 w* B# F+ i0 x5 B
/* Initialize the API environment */3 a* r0 ?( E& T$ b! R
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
M* W+ p( o# x% Q UF_MB_data_t,UF_MB_activated_button_p_t );7 m `# J1 a$ F. h* z: D; a! i# u5 ?
static UF_MB_action_t actionTable[]=
8 r$ u1 Z6 W, g: R, X( i) ? {
9 f5 t. y- b5 |: K3 B' a {"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
# B% A: N \6 x* y2 V {NULL,NULL,NULL}# M l" D7 V! |
};
$ J0 ~8 { `! Z, c5 d int errorCode = UF_initialize();
2 `4 [ s p, d% `; l$ c if ( 0 == errorCode )1 j! `: ~# ~$ a- S3 e3 a; F
{
4 Y' k0 `3 F) A4 @% U& W UF_MB_add_actions(actionTable);
& h. {( j( a) }: `6 |# h errorCode = UF_terminate();
: w# C4 h0 x* M7 m2 H }
, D' D$ N3 v0 `9 C: j* y6 B8 Y9 u) O PrintErrorMessage( errorCode );* @4 k3 l( y- v8 D) H5 Y; s& J
}
: u( Z/ i) I9 z+ r* ]3 ^/ V' d. |0 @6 p5 q3 F& m r
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(9 v, B8 @( @7 G% ]0 j1 N, o+ x
UF_MB_widget_t widget,
5 [7 H: D; \ S4 Q. `7 C UF_MB_data_t client_data,
: B( t1 n& e9 [4 X8 H UF_MB_activated_button_p_t call_button6 G% g; B3 g9 W# c
)
9 L6 ]* Q* n! H7 L7 T! j{/ C4 s9 w/ E( n! I; m" ~
UG_UI_calculate_data m_data;
; Y2 ^% {& @1 C" Z& i int response;
7 L9 M8 P# |; t2 E" n3 F# R LaunchCalculateDialog( &response ,&m_data);2 U8 l! ]- ?$ b: U e# q* L4 {
return UF_MB_CB_CONTINUE ;0 K% Y/ `9 B" t' M a, R+ e8 W
}
9 B9 `6 R; M+ V3 ~6 _! ~/*****************************************************************************
! P/ i- G! x7 A& l; T9 t** Utilities
$ d$ D$ G+ x% {7 r$ f*****************************************************************************/
) f, r; O0 O9 b* r
3 q q) n3 `' v4 @5 p/* Unload Handler: P v- _4 \5 m5 b
** This function specifies when to unload your application from Unigraphics.
, [+ q/ M; B) X$ O** If your application registers a callback (from a MenuScript item or a
/ @. r1 W' s6 R' U) J/ \** User Defined Object for example), this function MUST return$ R6 r! \2 X2 X4 f
** "UF_UNLOAD_UG_TERMINATE". */
' }: P/ Q* R) }( rextern int ufusr_ask_unload( void )
/ F( g) [9 ?2 ^- H% ^{% f* g& o2 i( i: u8 B g# _
return( UF_UNLOAD_IMMEDIATELY );* Q, i: t" {6 z" T4 k9 O
}
* V: _4 ?# m0 q
{' w: w6 E8 Q; C! Y' p/* PrintErrorMessage6 ?1 b8 `9 F( o% {2 J
**( q0 w. t& O9 p2 @
** Prints error messages to standard error and the Unigraphics status- @/ Z9 l, e. y. V: G
** line. */
1 w( w4 p$ K6 lstatic void PrintErrorMessage( int errorCode )% A, }$ X9 a' e) `( Z
{
Y0 A2 G1 [$ {* C if ( 0 != errorCode )
/ Y) F% E+ V5 z& Q, }2 P( X {2 G0 g8 O6 Q% L/ K6 h
/* Retrieve the associated error message */2 E( j3 j R( p9 A( q
char message[133];) l- G( ^9 v3 F/ x& z
UF_get_fail_message( errorCode, message );" ?* }4 g( h3 r, L/ P3 s) l$ m+ \/ ]# t
% S' a1 Z' B& _4 S i /* Print out the message */
% Z X; N t" |# `8 H* b1 _- c- g+ E UF_UI_set_status( message );& u( M0 e0 ~' d
) z$ r( C1 Z" `. _& x
fprintf( stderr, "%s\n", message );
: t3 y: B" E5 n! o }
; o$ m# ^4 d2 o; D& X1 j}
. c* V: A D s! c( P$ h- D) P以上代码编译之后显示2 ?( i b" h6 M! C
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int$ u% @4 W- A% z- z
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
- z) H+ j3 N& r% u! r自己怎么都解决不了,不知道哪位大哥可以指点一下小弟) H8 @8 g8 E# ]" _
- A4 x; }8 G- N- ^& \' W; A; ~ |
|