|
|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>
]' k9 {- E3 X: p1 J+ D#include <uf.h>
- ~+ P0 w F i7 M#include <uf_ui.h>9 G/ }- S' ~8 B* f
#include "UG_UI.h"& g; l2 }4 R$ c0 U& ? u
#include <uf_mb.h>4 T1 I" @5 r' `" Y, Q8 D
#include "UG_UI_calculate_dialog.h"; ~' B3 A* I7 T
. ?2 D$ |$ d# z9 {5 A/*****************************************************************************
5 h) \: Z5 d/ [+ X$ d** Activation Methods: \9 m% U+ s$ V, f
*****************************************************************************/9 I9 L: ~8 R b- j1 z
8 k+ \ w* {# v8 t% f; }/* Unigraphics Startup
* i& ~" e T. g5 X# l- o** This entry point activates the application at Unigraphics startup */4 x. |' k1 Y, N& m' I+ L. s
extern DllExport void ufsta( char *param, int *returnCode, int rlen )$ ]" O4 b2 N# f
{1 F- H. M6 M7 Y. L6 V- F
/* Initialize the API environment */
3 J" [) j9 [. u, k1 [ static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
0 ^1 @4 V5 O- v; P2 F+ g% v z+ U UF_MB_data_t,UF_MB_activated_button_p_t );
- F; J# c+ [# U static UF_MB_action_t actionTable[]=+ W" `8 y3 K i v" u* |# W
{! O; @% u0 k& J% l( P* _
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
# R) J) o3 a' ?' |5 A+ L {NULL,NULL,NULL}
9 Z3 G2 C' K; X. I( W6 a };0 I7 r1 ~2 p0 X) `- X& m
int errorCode = UF_initialize();% r t# O; ~6 _" q, |9 K. y
if ( 0 == errorCode )# p% ^9 Q' m# p! u
{
! s: Q g$ r. u$ m UF_MB_add_actions(actionTable);5 _8 K+ |' j1 r7 l; e M2 a9 p
errorCode = UF_terminate();
. s" D4 ]- a( D }
& }& J9 d5 @4 U. Z PrintErrorMessage( errorCode );+ B* p6 s3 l/ K3 R3 [, a" A
}
' x+ f/ J! z+ X$ ^& m7 ]- B/ F: c( z5 a" q4 m
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(" b& O* k0 s/ L q( _. Y. P, B. ^ a
UF_MB_widget_t widget,0 N! U8 i4 Z; v+ K9 \
UF_MB_data_t client_data,* T0 b) |. @& p, F
UF_MB_activated_button_p_t call_button! f7 R+ {$ P9 z5 _/ ]# d
)+ h. z. {6 x, Y y
{& ~0 h; b7 F* O/ s) w
UG_UI_calculate_data m_data;
$ v+ o0 D7 q+ { int response;
0 Z) n X/ L- g% E LaunchCalculateDialog( &response ,&m_data);! i% ]% r0 H( H) Y
return UF_MB_CB_CONTINUE ;
9 a0 q& c% B& X0 `. `}( C) ]3 F! s2 |+ H1 ?
/*****************************************************************************% A& i. b- P [% S$ ` f" K6 p
** Utilities7 b+ x6 o' t S: r- k4 \% |
*****************************************************************************/
6 B9 i* D* q" z9 B7 q* ]
, l F `+ n3 m/* Unload Handler" a) I7 g' N. V# x T3 { ^
** This function specifies when to unload your application from Unigraphics.' d5 |; [3 o+ v. }, @/ R% d( o" a4 d- R- [
** If your application registers a callback (from a MenuScript item or a2 x0 D' A: `/ R+ i+ v
** User Defined Object for example), this function MUST return
9 ^: E& B& w# D7 ]8 w% ?" A8 B** "UF_UNLOAD_UG_TERMINATE". */: ~8 U: ~, }) I X, b! b
extern int ufusr_ask_unload( void ): l* b" a3 q- }( M- L
{
2 c7 l, d3 j/ ^' Z0 O' m% I return( UF_UNLOAD_IMMEDIATELY ); L8 s Q' G2 L5 K1 I3 z0 y4 U( u1 t
}. [; y, }& g7 U! }
# l9 t+ T, P, s/* PrintErrorMessage
- G9 j) J% T8 \: q** }$ k: v/ }9 E3 w+ ?( ~
** Prints error messages to standard error and the Unigraphics status$ z4 Y1 x7 f/ L
** line. */* j5 e; }! B; l
static void PrintErrorMessage( int errorCode )4 f% A( C# o+ [2 B* Q. ~- F
{
, ]! v% M) [+ o% j! K7 i if ( 0 != errorCode ); G) x5 L+ i' {, D* ~; }2 v
{
3 U3 b6 p* E u5 {) I; G /* Retrieve the associated error message */8 l0 T- _0 e" `* u
char message[133];
% N' i( ?9 o$ n' u UF_get_fail_message( errorCode, message );; u4 h0 w: J# Q0 {* W/ T
5 k9 F: f2 g j9 ~" U! B /* Print out the message */' J/ G- F% p( L4 B8 A6 n) e
UF_UI_set_status( message );# q+ i6 M% V5 H/ v( q1 @
& a5 w3 n3 N2 z fprintf( stderr, "%s\n", message );* \& }$ ?: i9 f% Q# N3 B' |
}
d) w" x9 ]4 o( l}
' f7 U$ x+ X# T: D/ M- @以上代码编译之后显示
! F* y- t# T+ T( E" ~d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int6 P1 p7 I: _. n6 n* c6 `$ Z
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier& [4 {# |, T+ l/ _
自己怎么都解决不了,不知道哪位大哥可以指点一下小弟5 ]' U0 y7 l& [$ u) A( v L- [
! p3 D3 r0 r* s6 m5 U |
|