|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>
; s2 x/ C& K4 d: z/ i4 K8 J& w" h( X#include <uf.h>
" [5 s; `1 d" l, `9 R$ ]% A#include <uf_ui.h>
3 |8 @# b" ?8 u1 v$ b0 R#include "UG_UI.h"
s0 r6 K5 E# D- ?: l% \#include <uf_mb.h>
}# G; Z6 R# I! i6 [, {3 O#include "UG_UI_calculate_dialog.h"
a8 v; L: h' O' V0 V/ ^3 b+ w, t4 |+ `$ q9 Y+ ^( \- ?
/*****************************************************************************1 K+ Y( `! T: J
** Activation Methods( [; q+ j+ w; g; C9 a) Y' J2 W J
*****************************************************************************/
, C" y B7 {7 E4 g- w/ B+ t
5 i3 Y4 ?* s! ?- i* `/* Unigraphics Startup
7 `/ Q3 u. g) l c0 u** This entry point activates the application at Unigraphics startup */9 @3 C% h" J) o: k% b1 [
extern DllExport void ufsta( char *param, int *returnCode, int rlen )0 T; I# K/ u |$ u7 y T! A1 L/ ?1 j
{
* ~2 V+ ?% c' ^& f0 c, g /* Initialize the API environment */5 a& R: b1 T, v: t% q" W
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t, }3 g9 {0 M1 ~, j1 W% o5 v% A
UF_MB_data_t,UF_MB_activated_button_p_t );' h* O4 m# A6 U- T
static UF_MB_action_t actionTable[]=' c* F( g# @7 t, P
{
6 I8 L+ ]: e1 i {"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL}," \7 V Y3 S8 K9 C
{NULL,NULL,NULL}) c$ M2 e4 o3 A
};4 V% J! Z4 _/ h# P- r# [- i. U
int errorCode = UF_initialize();2 j0 @1 v7 D! Y6 T6 f
if ( 0 == errorCode )
& P& g6 w- Z7 X0 s9 I3 H {! j$ ^- c( ]3 A# }- [+ t
UF_MB_add_actions(actionTable);
5 r* J! j$ n8 {4 t. i* x6 S errorCode = UF_terminate();8 E. m% O$ d5 _& d5 c/ A
}
9 Q9 {. f* U) d: k# i, h PrintErrorMessage( errorCode );
* R T* }! l$ ]& f6 C: \' S( S2 @}
# K$ }- H- r# w# Y; B' x1 A$ _% f. ?; F/ P9 `" V$ m
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
* s; U. U1 Z/ f1 `+ R' {& w5 S+ s UF_MB_widget_t widget,6 _' ^ Z: z' W! k8 f' |
UF_MB_data_t client_data,4 O4 x% T$ Q! w" r8 K! s
UF_MB_activated_button_p_t call_button
* `! Y: f1 l; n; x6 i )1 I/ D* S: b, G2 M: \# U+ N
{$ f! {2 {, X+ E- R3 A
UG_UI_calculate_data m_data;7 F% C- H( S# }5 y
int response;
3 _8 K: E& R2 n LaunchCalculateDialog( &response ,&m_data);
/ E: l$ n( K. Z- V7 \6 R return UF_MB_CB_CONTINUE ;. Z4 g( [. v' N% g6 y4 P5 j
}
$ ~; @" h: T, C6 S* i/*****************************************************************************
. n9 Z7 p( z! p! {: D/ ]* S2 @1 V8 z** Utilities
' g- j* P& j5 P2 S# _*****************************************************************************/
! L! k7 D! j" X+ r
. P3 q9 {$ R: e! C- a/ `/* Unload Handler
' B8 a w" _, \4 `" V, L! o** This function specifies when to unload your application from Unigraphics.. ?4 y2 K K. L; g2 O3 A& g
** If your application registers a callback (from a MenuScript item or a
& ?' n- q* ?+ {6 [& |7 U** User Defined Object for example), this function MUST return1 ^4 y2 c" M& T
** "UF_UNLOAD_UG_TERMINATE". */9 t n: S& ]/ C* A$ w; Z
extern int ufusr_ask_unload( void ). Q5 t& Z2 k7 C& s3 g8 Z3 t0 ]# D: D
{# q* |& n5 m# D* k. A
return( UF_UNLOAD_IMMEDIATELY );& A: E- ~( o7 j0 z, X* A- J
}
: j: C! v0 N/ ]" y* Z! c/ A8 k! J! W+ B
/* PrintErrorMessage
- d3 `/ {2 ?0 r3 e v" C**
" P' f4 ~/ Y$ g0 ^) V9 g8 O( c7 |** Prints error messages to standard error and the Unigraphics status1 Y8 n5 F8 U; N. p' ~6 C: E
** line. */% \4 k, y3 n' ^8 a) V) s
static void PrintErrorMessage( int errorCode )
- ?& U% Y7 C# _' C. G; n8 G{: x; a2 U. C X
if ( 0 != errorCode ): {/ @0 v/ E+ f, L( v
{& K/ r, |1 H- q3 j$ S! d
/* Retrieve the associated error message */
0 l X1 N' |( U" t char message[133];; |- p) y8 B7 w
UF_get_fail_message( errorCode, message );
4 t j& c6 g( _7 H7 a* `' x ]
( }! \1 E* B- {, }! m0 j6 m& F /* Print out the message */
; M, V# {2 @3 W0 P! ^0 m UF_UI_set_status( message );
, r( l5 [! [" u" @- R( e- N, r v4 V/ N2 t) R
fprintf( stderr, "%s\n", message );6 Z9 r7 ?. r3 J1 R' b9 b! i2 S
}
- w0 U# \9 I0 D; J7 |. v}
% w6 R+ F. ~1 z. J/ Y9 w, |9 Z% T以上代码编译之后显示! k1 E$ s- ^7 S- x6 A. T' W6 t5 @
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int
+ H4 z. g8 ^, Z7 K" h$ B; @d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
2 }2 w9 j, [# }: n4 n2 Y自己怎么都解决不了,不知道哪位大哥可以指点一下小弟$ a+ K0 k% y6 X; a+ o5 [$ X0 v6 ?
- H E9 c9 g: f4 G
|
|