|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>
5 U- S% J4 t& C/ N2 w#include <uf.h>
5 s4 q& O5 R: m#include <uf_ui.h>9 r5 [; F e; I: H. P: f* B
#include "UG_UI.h"
- e3 O/ V: P. P- \#include <uf_mb.h>% U3 @" k b5 u4 u7 L; y; d
#include "UG_UI_calculate_dialog.h"
! m, W4 n0 Z0 l: x0 s5 j: a; h! _2 L# ^, G
/*****************************************************************************
" I$ j- u+ A. T( \** Activation Methods
$ }8 M7 L6 x. T9 {' d5 K*****************************************************************************/3 j% O. b& [- W! A, W8 V
1 T: ?1 A4 P0 P1 q! Z9 X- j
/* Unigraphics Startup
6 D7 \" B% E$ f$ i, }, R7 Z2 Y0 H** This entry point activates the application at Unigraphics startup */
$ o) I A8 |2 \3 b! j6 t' Xextern DllExport void ufsta( char *param, int *returnCode, int rlen ). |- v% m. m D. ~
{& v9 z- p9 G3 _3 l+ V4 l
/* Initialize the API environment */0 N0 Q' }) v% g* @5 N
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,9 y, c# y- }2 W' O
UF_MB_data_t,UF_MB_activated_button_p_t );
) M% s+ X0 E5 l& [; q5 z$ A7 F# \! r static UF_MB_action_t actionTable[]=. A) u+ }6 e( A
{
# ~8 D8 }) E; v {"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
; T) m ]0 |/ | {NULL,NULL,NULL}% Z1 \; c, w: s7 G
};( k f/ {! c( h2 D2 |4 Y
int errorCode = UF_initialize();
5 S' l5 A) a9 a' o9 D# W* S if ( 0 == errorCode )
0 E: c9 y9 f; k& F {2 o1 X9 c+ M( T. ]: W$ x
UF_MB_add_actions(actionTable);! J+ n* E3 a5 [3 n$ f
errorCode = UF_terminate();
7 H6 N7 m2 h- b7 N }" g1 W; k: d+ _2 X
PrintErrorMessage( errorCode );* G% T8 d {+ Z* f, j
}/ \' ]" { Z. ^
& ^1 ?. O2 F4 v+ b( L4 s9 Bstatic UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
& V5 r$ d/ G: ?$ f UF_MB_widget_t widget,
, i; ~2 P, c x7 J8 V2 H UF_MB_data_t client_data,! b. _2 r+ k Y8 u
UF_MB_activated_button_p_t call_button
; f$ G* \: t8 P5 C& ]4 A4 k5 _( P& L$ t )
* w y& ] s7 A) l{7 m$ r& |) @$ s+ l1 w
UG_UI_calculate_data m_data;, j# q2 d8 R& t
int response;) O$ m4 H, `1 f+ G- x
LaunchCalculateDialog( &response ,&m_data);
0 a! e" G+ F- w7 D2 n6 G- a return UF_MB_CB_CONTINUE ;5 ~1 W7 @0 M. M/ H- C# h2 y6 g
}
' n, D% ]3 i5 Q( a! c/*****************************************************************************
! S$ C0 x q, D. L, Q/ t& m1 w** Utilities
9 A2 n7 L) |+ |0 e*****************************************************************************/2 B3 ~$ d% z+ ~1 Q% Q3 }- g
* H5 \8 E4 G; t) ]! D/* Unload Handler, m: i D# K8 ?5 P. |
** This function specifies when to unload your application from Unigraphics.
* l) R! g1 \. j9 @& B0 |. Y** If your application registers a callback (from a MenuScript item or a; q$ g7 A& J' j! T. I8 l |/ x
** User Defined Object for example), this function MUST return
j2 K" j5 w: \** "UF_UNLOAD_UG_TERMINATE". */
5 w5 j6 D# I$ |. N) o9 ]extern int ufusr_ask_unload( void ): r* a8 D; E0 O4 v! e% |% A
{
+ ?/ P; Z0 K7 N- T9 q8 ^ return( UF_UNLOAD_IMMEDIATELY );
) J) ?7 L) Y/ j3 C! X; _}9 B+ f6 }! B( @/ u
3 S( }( ]1 y' W/ v
/* PrintErrorMessage" f5 _* U* F, W+ V* z* R
** s3 P. ]: L1 ]1 s! ~; Q. j
** Prints error messages to standard error and the Unigraphics status
$ l% J, h4 Q9 t7 ^** line. */( l4 A& Z! T% ] B
static void PrintErrorMessage( int errorCode ); [( H: Y/ f3 h$ g- z1 F
{% e# f6 j+ \" V/ L, ?. |; c
if ( 0 != errorCode )
! J2 `+ K; [- Y {" a: W2 M/ h/ Y+ f- D0 R" ^# a! O
/* Retrieve the associated error message */
* g( G2 E' j0 ~% y' f char message[133];
0 M+ P/ V5 ^% X) P% Q# ?) d UF_get_fail_message( errorCode, message );9 b* O9 T" A! j0 E; A
* y8 }# r7 E% r9 p. F) J$ G
/* Print out the message */3 w' \0 p: O8 G2 F3 |' _( g* s {
UF_UI_set_status( message );8 h6 B$ X0 u+ g$ b
. }- d# ]( Z$ U* }6 c. N2 }# @! N
fprintf( stderr, "%s\n", message );. G8 `9 }( P% `( V Y
}
/ G& m7 y. G) I# W- `}" i) L6 d5 q$ [# g( }
以上代码编译之后显示
6 r7 E# B9 C0 W2 ad:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int
) y" y( G* n* n7 x! p: _5 wd:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
5 O8 W& W2 x5 Z# p自己怎么都解决不了,不知道哪位大哥可以指点一下小弟
" Y+ i, Y7 |7 s' k; Z+ K/ U, ?6 y, {% X: E' m
|
|