|
|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>
, m; F0 e6 p; T) v/ W#include <uf.h>
0 @6 c' I( z! J" O* Z7 D#include <uf_ui.h>3 w! g& s& ^: H+ q+ @8 M
#include "UG_UI.h") W9 p; _: [) r( T: Z. \6 @
#include <uf_mb.h>- y4 p5 U2 F8 p9 i
#include "UG_UI_calculate_dialog.h"
# u, b @8 b1 c. z3 `( K+ G5 o" ]* [$ b: ]7 n7 g. j
/*****************************************************************************( R5 a. _- L! Z2 Q. c7 n& @/ o
** Activation Methods
5 L' e9 h5 B: C8 J*****************************************************************************/
0 \4 m3 W( [" m A$ g
+ b7 q) g0 w4 F1 x/ [/* Unigraphics Startup
. T* A- v3 g! [) {** This entry point activates the application at Unigraphics startup */; ~9 ]3 g6 _2 l/ Z
extern DllExport void ufsta( char *param, int *returnCode, int rlen )3 G( b7 c/ V, ]9 d$ u
{
4 N! m' L/ v ?' k* f /* Initialize the API environment */
2 c5 q" \7 C) g# [/ j& h6 K5 ] static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
2 Z% O' c" C5 z$ ~) W UF_MB_data_t,UF_MB_activated_button_p_t );" S9 e& z/ i1 K9 W. c9 w0 W3 [
static UF_MB_action_t actionTable[]=' o8 c+ R( q" a" j( W h- m8 A
{6 p! E `+ l$ g; V. j2 Y
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
" N* t( S c$ B$ Z7 O {NULL,NULL,NULL}
* {5 y! s+ b8 e( [ };
t9 E! h$ |0 j T int errorCode = UF_initialize();
; y# b- E- k& `: j, P: Y) W1 ] if ( 0 == errorCode )
/ |5 ?8 h: h R# C: I! C! I {
- D, B4 y! f0 g) P3 ? UF_MB_add_actions(actionTable);' n8 u. ~6 E I/ A8 p
errorCode = UF_terminate();# S! l# |9 i- f$ j: p4 I% Z
}6 ]" n& D5 h1 P3 d4 a( y4 M
PrintErrorMessage( errorCode );
4 V& ]8 h f* `: M" Y8 ~1 }}+ W$ y& z% L# d; D
0 ~! J+ N' |8 a& S1 xstatic UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
+ l2 q4 m0 t5 j UF_MB_widget_t widget,/ a6 R4 |/ a. {- r/ X
UF_MB_data_t client_data,% z i' B% X1 q5 \0 v( E
UF_MB_activated_button_p_t call_button
6 T" K+ N% X, r: e* W8 K9 ~. i )
4 | T& e6 P# z! f- L{
# H d; b$ o1 t0 x4 s" A, A, d UG_UI_calculate_data m_data;
' v) Y6 [% Y6 V V int response;
, \9 ^- V1 L% U* |7 _* R; ] LaunchCalculateDialog( &response ,&m_data);
* d' Q* H0 y9 Q4 o/ x, ] return UF_MB_CB_CONTINUE ;" ?1 b: f0 h! c5 o! c. w
}7 G# T. U- ?* l) C% s/ l$ v$ R
/*****************************************************************************- g0 V9 C) e% u" q- D/ b) ]) p
** Utilities! @9 r7 r6 {2 }
*****************************************************************************/
- W: o& i' R/ E
# _: K) a* _: r; H/* Unload Handler2 O9 M9 A, _# a D/ {
** This function specifies when to unload your application from Unigraphics.' L4 Z& f% v$ E S, i
** If your application registers a callback (from a MenuScript item or a
& b1 s- S! p$ ? p; r** User Defined Object for example), this function MUST return
: p& E, Q1 V+ r2 K8 a** "UF_UNLOAD_UG_TERMINATE". */
8 \6 w/ l# `$ n, e% x6 sextern int ufusr_ask_unload( void )! w0 K7 J6 c2 B) U
{
5 ]8 q, o- _3 M9 {+ a7 @ return( UF_UNLOAD_IMMEDIATELY );
( j- t2 _$ H0 x3 S: a! ~}
" Y; ~' y3 s- y$ P. C1 W
3 a4 B2 J" Y- O8 r/* PrintErrorMessage+ C0 v2 a: _* [4 G
**
0 v( P" _" b, q$ J: e** Prints error messages to standard error and the Unigraphics status
! {9 f( a4 Y5 P6 r" n9 J** line. */5 k, x- Q9 k5 J; C; `. `
static void PrintErrorMessage( int errorCode )
3 n+ A5 A8 O4 ~9 n0 Y2 Y{
% r; [7 J$ {" q& o6 G. D( o if ( 0 != errorCode ); w9 l; e; C: w$ S2 e! f
{: g7 M& _; o: K) u5 D, `
/* Retrieve the associated error message */$ W* w! M6 }% k5 ?6 z
char message[133];
0 h' {' u: ?* m7 o' }% e UF_get_fail_message( errorCode, message );
# w* Q2 h- l2 G) E3 r# e s; O" F
0 o& ^% A7 |# U; ], e9 d /* Print out the message */
. D7 n! R1 T: d& d UF_UI_set_status( message );
" I9 @! `% a. k e& d+ U x; x
* V+ a8 c& o A" I4 ~" a fprintf( stderr, "%s\n", message );
( O" [* |& x. L. `8 n }! i' p3 I8 V9 i0 j' X
}
) {1 G0 [8 N- ?以上代码编译之后显示- p! c- H( q+ g1 q1 [ [& q
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int
% ? F! b8 f, \8 u, R3 V* Xd:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
, g: K) R. b! t' @9 V& p) |自己怎么都解决不了,不知道哪位大哥可以指点一下小弟
9 [1 ]( H" K, l( R! z* y: u4 m( z
* T+ w! a- R* ]) u |
|