|
|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>
: b- _, T9 d& h' p7 {9 \: x#include <uf.h>2 H7 l' O3 _0 K+ ]! W4 t$ U
#include <uf_ui.h>
- a7 i6 O* g: o6 q#include "UG_UI.h". ]. [9 s9 J, ^( K: k8 y7 U! S! ~1 C4 ?( @
#include <uf_mb.h>
1 d' `4 \* x: J7 G0 _#include "UG_UI_calculate_dialog.h"
+ |3 d2 I+ t: _- a) b' O7 K+ j3 M! p' H+ z
/*****************************************************************************: g! _! y# u& W" s8 u
** Activation Methods
0 h, |+ m/ v) ^3 N7 b*****************************************************************************/
$ K) l& v7 E# x8 o: d" N' ?
7 @2 _4 {% u y' o+ ~5 _. e4 Y/* Unigraphics Startup
2 V- _# \+ u! W** This entry point activates the application at Unigraphics startup */) v* y t" S0 Y% n5 j! @* Z. G$ ]8 C5 F
extern DllExport void ufsta( char *param, int *returnCode, int rlen )/ d e" p+ [! ]- O2 _
{: B4 {5 }& L% v8 I+ Z/ l
/* Initialize the API environment */- |# q' n4 Z& H @4 h
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,! g, r- m( _/ o2 D% {/ D. }) H
UF_MB_data_t,UF_MB_activated_button_p_t );& L! B D0 ?; O0 y4 D
static UF_MB_action_t actionTable[]=; S: @# S8 }8 E$ O/ `( E' r( i
{
9 f+ \& n8 S: A$ F: k0 w: p! @/ a {"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
: K R% G- h6 m" U& E* n# _ v {NULL,NULL,NULL}
0 ]5 m% I+ @" Z* f$ T };
8 R7 E: T, O$ s Q+ x4 H& T int errorCode = UF_initialize();3 a9 b( G% C9 t5 P( f1 ]
if ( 0 == errorCode ) P9 U+ \: i9 F" [4 P4 I# F m
{
& {' x$ C/ b6 J) ? UF_MB_add_actions(actionTable);
+ H# c$ g+ V% X( h# n: b errorCode = UF_terminate();
5 R3 [7 h/ p: |2 o1 O* v2 { }
6 B5 P) t* y5 j1 y PrintErrorMessage( errorCode );" E* g u- m7 u; ~2 e/ y7 _
}" P; B( I, W6 q* I0 \
, [# D8 B' _; L* f
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
0 V/ h6 p) f/ Y6 e UF_MB_widget_t widget,
! t- E4 e8 q9 | UF_MB_data_t client_data,
( ]+ y: S$ p3 C8 C) \ UF_MB_activated_button_p_t call_button/ @2 S! k9 s5 c# t; j( K
)
- r( k* H1 j6 Y3 t8 j: s{
( \) X( k+ U' f. |) j UG_UI_calculate_data m_data;0 g- B% F7 `' C5 t5 E) E- s
int response;: r! R: d/ v0 R% e2 i3 J
LaunchCalculateDialog( &response ,&m_data);9 E8 X% L1 U6 G9 }
return UF_MB_CB_CONTINUE ;1 h+ ^; q& ]6 Q7 `
}
! w. `. q, V' B% P- u; R( x/*****************************************************************************5 ]" L% \1 r& A# u$ `
** Utilities) R/ I) k0 Z% e% r) n5 D" L3 _' P
*****************************************************************************/1 j9 E$ y( J# f: }, q& q. }
: _- m( ?. Q) m( ~/* Unload Handler2 e, r, z2 |5 X- D9 \
** This function specifies when to unload your application from Unigraphics.
9 {, }4 e5 [( p" A** If your application registers a callback (from a MenuScript item or a
1 r4 \0 _4 K$ v8 `) P( v7 y** User Defined Object for example), this function MUST return) } N$ m$ V1 _) Y5 a! W
** "UF_UNLOAD_UG_TERMINATE". */ V( @9 s# g: E6 ]
extern int ufusr_ask_unload( void )7 n) G) g. l) U& Q
{2 @: ?" d% w" `- H* G8 C
return( UF_UNLOAD_IMMEDIATELY );# y8 Q" H5 B8 e j. E
}0 f# N" C9 F% s1 t: G
8 O/ L8 U9 ]8 f( O1 Z" S/* PrintErrorMessage$ N( K4 w( y) l/ f7 Y' b V
**
) C" \3 i+ p% O6 u1 K: w. d** Prints error messages to standard error and the Unigraphics status# ~* @: j7 ~0 I3 {7 _
** line. */
! s0 P& M; M6 R6 d5 O" Xstatic void PrintErrorMessage( int errorCode )
# G8 }8 H G7 C7 }; M{) `# q% k" u' v% E
if ( 0 != errorCode )/ \' Y; o) ] n5 V ?9 w
{5 I6 ~3 K- L F( Q, ]( S, j9 d9 Q j8 |
/* Retrieve the associated error message */
4 @0 Z7 G! w5 G. V" ?& f/ ?6 g char message[133];3 w9 {+ y) i |; ]7 d' j+ F
UF_get_fail_message( errorCode, message );& p3 P) e9 U8 M+ U+ Y. f
; F/ {: W1 `+ q3 V# x% @" U _- D+ Z /* Print out the message */
! w# U7 _6 G* f0 v& y( t UF_UI_set_status( message );* r! E1 A( J& g' Q- j( ~* s, w
- z5 t8 Z9 R8 C1 M: |. Y fprintf( stderr, "%s\n", message );# `7 q/ Y7 i9 w/ ]
}
7 u& S; C# \. l}
" ~) E) P. `: U( }2 G2 i以上代码编译之后显示
; S/ c4 `1 H+ t# ~d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int
: W6 F' Q6 z; v$ l$ {; Id:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
3 O; d/ o* c- K m自己怎么都解决不了,不知道哪位大哥可以指点一下小弟' P. S7 s% s% L; D7 ^2 |2 B- X' X
( L+ {3 q7 P! ~' ] p |
|