|
|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>" O" S, o" r$ s* m
#include <uf.h>
) r' t' H; |, {* ~! o#include <uf_ui.h>/ a0 D0 W4 f, g0 r- ?
#include "UG_UI.h"
4 U, Z; W! Y- K7 R#include <uf_mb.h>
* P( \: R! Z. Y#include "UG_UI_calculate_dialog.h"
4 K- b# ?' e3 G2 w- v: M0 o9 X% Y( X( r7 g/ W C
/*****************************************************************************. P6 L1 D6 q8 Z: ^" u
** Activation Methods
5 e3 R/ b' K9 E, [0 D- V( {2 [2 F" t*****************************************************************************/$ _5 ^, p+ U0 ~$ Y8 _ z$ ]6 @3 _
9 l' [( K1 W7 i' w
/* Unigraphics Startup5 A9 X h9 J' u9 x& [
** This entry point activates the application at Unigraphics startup */4 x y4 n+ k/ ^' `
extern DllExport void ufsta( char *param, int *returnCode, int rlen )' b2 ]0 z. X6 t' W8 u7 a
{
- S3 S7 X2 y6 g7 K8 M1 o w1 J /* Initialize the API environment */2 G% o) k! h- l* g, K
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,3 l; b; o; B$ y- k
UF_MB_data_t,UF_MB_activated_button_p_t );2 a( ^, ~: { r+ I+ {
static UF_MB_action_t actionTable[]=
: N7 a+ S& ?9 e+ ~; M {. F8 @" A$ c( d8 d- V" ~
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
) F* c9 m. T) u$ l6 u {NULL,NULL,NULL}. X! j/ r7 e+ J% U5 ?# C
};! A! L" [% P" Z& H2 x- B
int errorCode = UF_initialize();
- |/ X( Z( X+ r" |/ ] if ( 0 == errorCode )
* W2 w7 b) V/ c8 X/ N7 S {
8 {* c, U$ A$ n. H# q UF_MB_add_actions(actionTable);
; B/ h% v7 E1 ` a% o errorCode = UF_terminate();2 d9 B0 a1 t' S' x$ U
}! ~4 B5 @) g/ A! W8 e4 H4 H$ P
PrintErrorMessage( errorCode );9 h% Y% x8 A2 E: E1 t% C$ ?
} e0 p/ O# ^( G
+ ?9 T/ E3 P/ [) H0 T' u! t
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
8 u* [& d* }0 l% K5 I) J+ L UF_MB_widget_t widget,
9 n8 E1 A- f+ v UF_MB_data_t client_data,
0 U7 n; }6 Z% C7 q5 F' V) v UF_MB_activated_button_p_t call_button
" G) ?, V; E' F" _0 S )4 l5 m5 D8 R* i. Q: g. }9 i
{
! J$ \& i1 X- P* m UG_UI_calculate_data m_data;
) |# D+ y: g2 q: t. Q8 f: ? int response;( u& V+ M8 {: j5 C% k9 R( w. q
LaunchCalculateDialog( &response ,&m_data);/ \$ r9 ^) H1 c8 c+ K( |, t0 w% A
return UF_MB_CB_CONTINUE ;9 Y$ w/ G$ a, m8 h0 T }
}
9 g% N$ j# V# }* c/*****************************************************************************8 J# |1 m* ?1 _* ^# u+ r- X9 h( _
** Utilities
* T% H0 u' ?6 _*****************************************************************************/
2 r! o$ N$ G& g7 g
h% k, w. f" v c/* Unload Handler
2 c" H: H/ W5 z: q' [# F# n1 G5 |9 o** This function specifies when to unload your application from Unigraphics.8 y( u: h0 k* D |3 q5 \/ \9 q
** If your application registers a callback (from a MenuScript item or a
4 D1 Y$ D9 j9 Q: u3 V8 M** User Defined Object for example), this function MUST return
$ z! U2 M* M7 A** "UF_UNLOAD_UG_TERMINATE". */
" D% ]! y" j: w1 O/ aextern int ufusr_ask_unload( void )
% U7 U7 |* |2 c- K$ v. D7 M; J{3 g; p2 n( G; k1 y6 L( Y
return( UF_UNLOAD_IMMEDIATELY );/ c2 t8 u5 a/ u5 b- Y. A+ m
}7 F3 B+ G9 {* F B. ^1 o J7 `
" R5 ]9 |& K6 M8 [+ D/* PrintErrorMessage
6 I$ O" B. m- b; h7 W1 Z( j**
4 t8 C% b; n. ^9 l8 _** Prints error messages to standard error and the Unigraphics status
* ?9 k1 `4 r6 h1 @" G** line. */
3 A' U' V- r2 z, f$ `& Kstatic void PrintErrorMessage( int errorCode )% @- Q8 p: y c, c4 d; o
{
1 y" |$ s1 O2 [- |4 j if ( 0 != errorCode )
1 S: F" n, u7 E2 K {9 c1 f( m$ I" T H: v! n+ D! l) g
/* Retrieve the associated error message */4 G& F5 `" `: p" P$ Y, j2 m% e
char message[133];
2 \# A5 D; v5 S) b) b& c- S UF_get_fail_message( errorCode, message );5 `$ `, O6 S, T! y- R: D
$ u6 X0 J% R; T/ }# \ /* Print out the message */2 [6 A9 p S. | [# d
UF_UI_set_status( message );6 q( f8 g" z# ?: E2 H
% S( E4 q( K. Q" ]- d F4 d
fprintf( stderr, "%s\n", message );7 x/ k9 {, `. G* n* N0 I
}0 d* Z4 D* x1 O
}
G' z' w, X7 x+ f2 C以上代码编译之后显示
" `& C- I* \8 c [' ^d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int" ^: u( H7 `. ?5 T$ s
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier- v. a: s; |! i$ ~! u- Z
自己怎么都解决不了,不知道哪位大哥可以指点一下小弟4 F/ I" g9 B- k3 E0 W& s
* G! T! q8 I5 g) h" H4 s |
|