|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>% S: K. @5 g2 C2 s2 E
#include <uf.h>' j& _3 ]4 K* n0 \
#include <uf_ui.h>0 b/ U& c& H" `3 w5 [% V4 H% J" }6 m3 k
#include "UG_UI.h". e" A5 r" m/ i" h
#include <uf_mb.h>
/ q+ b: Q8 ^; f& _0 v#include "UG_UI_calculate_dialog.h"5 j$ |+ A$ g* Z7 }0 s5 b9 L; _
7 x; B% k/ \8 |$ z0 x/*****************************************************************************) X: @% ]4 n1 P# v* a y% P
** Activation Methods- T8 i. Y: b2 m. I A9 T% p6 x2 g
*****************************************************************************/: S. A1 S. s# E1 v w V- B' j
& Q* x: o0 w9 ?4 `- B
/* Unigraphics Startup1 a" w1 ]9 r4 Z: ^
** This entry point activates the application at Unigraphics startup */ a; p3 Y+ p& Y5 |3 S) x6 b7 Y6 q
extern DllExport void ufsta( char *param, int *returnCode, int rlen )
% s. l# l# q! J6 U S{
$ N+ M/ O& h& _; e- V5 H$ o /* Initialize the API environment */( n5 U. S8 g |; B
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
7 ~7 x/ _, \1 m7 u UF_MB_data_t,UF_MB_activated_button_p_t );2 v9 [0 b! h% U& ^4 w/ J& T
static UF_MB_action_t actionTable[]=+ s4 b7 _# ?% h' X2 E; {
{
4 g3 N! M3 U- M$ e( w' \& C {"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},9 X4 O+ y! j7 x4 }3 \
{NULL,NULL,NULL}
& X7 h+ k% c/ Q8 Y3 c. e/ y };
$ y. R4 e4 {# o# p- ` int errorCode = UF_initialize();
2 P" H9 L% b% D# I5 l if ( 0 == errorCode )
" J- L& |5 G3 Q3 m4 J {
" p3 S5 ~9 Q) O+ i UF_MB_add_actions(actionTable);
/ ~4 c. k) s3 _* g+ M+ D8 U' f errorCode = UF_terminate();. U: w5 g7 C) S! R" g5 E
}( k5 `, Q9 s% }3 S) D8 n
PrintErrorMessage( errorCode );& Y( R% |4 Y Q) O
}; B. q0 y$ q* T9 P0 b
' A2 `1 h4 s% |3 {3 r+ `static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
# [" y! k T* i X UF_MB_widget_t widget,# S/ l D2 R {$ r0 Y& B Q8 E
UF_MB_data_t client_data,6 c' ?6 N A+ T# {. U
UF_MB_activated_button_p_t call_button
0 n6 |6 q# E" V0 T: L: W )
8 M; W& Q e T- u) T: c{
, w8 u p# t( |$ C" K0 Z+ g# K UG_UI_calculate_data m_data;: ?% L' I4 i: ]3 L5 X% o+ `
int response;
, \. I: U' g2 q9 N LaunchCalculateDialog( &response ,&m_data);" p! Z0 V- {* C- o! X. C3 B& u
return UF_MB_CB_CONTINUE ;9 U6 I, O: n) ^" i' L" H9 N0 R
}2 o7 a8 Y, d- p6 g* }
/*****************************************************************************
- W- [& w, t$ n** Utilities2 `' ?" g4 {3 g4 u/ R
*****************************************************************************/
9 ]9 _* f& M& {. D* |$ t% f
- U4 Q% [' B+ \ E$ f0 j/* Unload Handler+ W- C x: K m$ O, E$ g# C3 p
** This function specifies when to unload your application from Unigraphics.. k0 w! a3 j( s+ W; y/ ?2 V* \
** If your application registers a callback (from a MenuScript item or a
) j' |& [, p/ N9 y** User Defined Object for example), this function MUST return; k* c% u2 n/ J7 L5 p
** "UF_UNLOAD_UG_TERMINATE". */
, Z' Q& L: n2 Z- E" T1 eextern int ufusr_ask_unload( void )% y' k. m8 i! p) ?& D: p
{
/ N# y' h- f) @1 l% Z return( UF_UNLOAD_IMMEDIATELY );
. `' b$ A9 T1 E- x+ V( b$ A' q/ l}
1 ?3 F6 P! H0 M* h, p
D& @ V6 q& C& J/* PrintErrorMessage
' ^* C M- c9 z, ^" C**3 g3 A$ \2 K/ b6 E! j0 ^0 J
** Prints error messages to standard error and the Unigraphics status* q/ U, f$ ?# _1 i0 l" }* ?7 o
** line. */+ @/ S( I; O( Z9 N# v
static void PrintErrorMessage( int errorCode )2 M Z; I, R. ]% `& t
{
3 q) z9 i" q" s9 |% e- q if ( 0 != errorCode )! u K& D l& k/ i
{8 a& l9 H) }0 v g: W# S0 ~
/* Retrieve the associated error message */; _" P$ A# }- m# U% e$ J% a
char message[133];6 w& l' v3 m1 P! p, r
UF_get_fail_message( errorCode, message );
* k$ K9 c4 F/ ~/ {( Z. g4 }$ C* }, h! q" G" ?
/* Print out the message */
* L5 [( A/ G/ E9 U1 l {2 U. R; B) R UF_UI_set_status( message );
' M+ w- r0 h' b8 a6 x% w
( | V1 D" V! z0 }! G, P fprintf( stderr, "%s\n", message );( A+ p1 F9 k' N9 G! Y5 {7 @
}( D% j- s0 v5 U( s. E! t( {5 L
}" _3 S3 }) ~ q; e) j/ f4 r
以上代码编译之后显示- g2 P5 ~9 x+ \+ Q; F, Z. a. H
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int
2 o- x$ m5 P1 p2 l- j8 ]6 ?d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier8 y; Z5 Q- O4 O' l* [" Y
自己怎么都解决不了,不知道哪位大哥可以指点一下小弟2 q! J% ]+ z! i) o; y
6 Q. E, U' }, p3 i; \
|
|