|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>
; w( E0 A: o( g" b#include <uf.h>. ^) r6 Y2 d3 p' l4 C( t
#include <uf_ui.h>
1 J/ L& M0 \: n$ O#include "UG_UI.h"- ^; P& ^- y4 a9 O2 ~2 J4 Y0 Y
#include <uf_mb.h>
& r7 w; p3 t: O. r( I/ Q#include "UG_UI_calculate_dialog.h"
# l* b# k8 N% A: i0 S& e, M3 {6 ?: {1 I* u2 m3 A- h7 _8 ~
/*****************************************************************************- x* d" H, P f" l- _- ]! E
** Activation Methods
" J% {9 X% p% |( u( ?# T5 P* O; s*****************************************************************************/# W( J( e4 U2 r
5 L X( K; z, u: j( \& n
/* Unigraphics Startup7 A% ?# _9 z0 ]" r+ f% g
** This entry point activates the application at Unigraphics startup */
9 p1 T+ I7 A4 h6 E& L+ qextern DllExport void ufsta( char *param, int *returnCode, int rlen )/ L% F* ~7 t: x6 ^) l
{# ~8 }7 }. |% E, W7 c7 U Y8 X! U
/* Initialize the API environment */
; E- T: ?0 j6 N Z static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,0 ?9 u G; e. P3 Q+ u. a
UF_MB_data_t,UF_MB_activated_button_p_t );; j& J; H% m: l" o" [
static UF_MB_action_t actionTable[]=7 h% S4 x, H$ o6 X0 g: U `: ~
{( \' H; t0 @* d) Y
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL}," K. W2 S* r: M; ^ y8 K. l; U
{NULL,NULL,NULL}
! H% p; P% E3 p+ b: a };
$ B& {# S" y8 D: ^2 C+ c int errorCode = UF_initialize();+ k/ T' j! v+ Z3 x V
if ( 0 == errorCode )' Y+ H# `9 i% o4 O
{
1 K: l J, I+ P8 x3 w6 R, M/ V- c/ b UF_MB_add_actions(actionTable);
3 f9 @2 \# t, u6 P* ^6 G4 V errorCode = UF_terminate();# \2 @2 C+ y# W H- f
}2 a" w- W- E+ p9 \1 q) K( ^ `
PrintErrorMessage( errorCode );
: X3 r3 I, K/ o4 i) }}
S0 g/ L3 D# _$ \
6 K" y; ]. {* a- Fstatic UF_MB_cb_status_t UG_UI_Test_Dialog_fun(1 T! q* W. i; t- y4 Y
UF_MB_widget_t widget,
* h6 ]6 W7 z x- V# n+ p UF_MB_data_t client_data,
- Y8 r8 h2 H4 v6 A) y E( Z% @ UF_MB_activated_button_p_t call_button
7 I8 T3 _, E3 i1 N8 A )
$ d( @0 k' d. t. ?& p" C{- ^9 J% A! g+ B, o& R
UG_UI_calculate_data m_data;
n3 q; J& W& i9 J6 { int response;/ x+ k) c- b1 {/ I3 _
LaunchCalculateDialog( &response ,&m_data);
7 P, n( V" t& h0 R V' k, m return UF_MB_CB_CONTINUE ;
- F/ s. }4 Y# Z4 H4 p, l2 L}
) s3 k( m- k/ ]6 {: A+ ^/*****************************************************************************
4 K! r- q2 f0 L3 B- G9 ]& c** Utilities
5 [0 D8 i3 K: y) `*****************************************************************************/
, A3 B j+ W; C1 k* R/ f% Q; _- W" Q4 H. D' D
/* Unload Handler
& m- B; P- W2 S1 s, \. C3 u9 e, f** This function specifies when to unload your application from Unigraphics./ G: p4 [* e; g# P
** If your application registers a callback (from a MenuScript item or a. F0 U" N% U) G M' j9 s) z
** User Defined Object for example), this function MUST return
$ m2 ~8 B, O( A" N5 t% T& y( T/ Z** "UF_UNLOAD_UG_TERMINATE". */; R% v/ V' F8 {& e4 a
extern int ufusr_ask_unload( void )
q. A1 y! ~0 e* t& l# [, f+ f{1 `/ D7 I* B5 T& P
return( UF_UNLOAD_IMMEDIATELY );
' W1 ~/ i; o7 o4 H" w9 o}8 x2 w0 X; x \, _7 f
& g/ M) H; M% \+ p9 y' [ T6 }/* PrintErrorMessage
" y# v. d' Q% N7 g8 C**
* K" p+ g* i- a. N** Prints error messages to standard error and the Unigraphics status
2 {5 s9 X( Q" B; s** line. */' z% o+ I( q# m- q: C) r5 ?
static void PrintErrorMessage( int errorCode )
1 g- J! h, c" H; d{' _4 ]# m( I0 p( P! W
if ( 0 != errorCode )
# q+ a/ G. ?8 x; y% \) v [ {2 c4 Q7 e% b- o3 l. Q/ Z$ |* R
/* Retrieve the associated error message */7 M% t% y' b* G+ a# r; | z6 H
char message[133];8 g+ \2 k& B7 p1 P# W2 `& \1 v
UF_get_fail_message( errorCode, message );- Z0 U/ {3 d# [ j% j
. O: k% e+ v3 b1 s) ?8 Q' ~/ e% x
/* Print out the message */
, R. @6 y" l% ?* i1 T% t UF_UI_set_status( message );$ Z+ a( l: R* D1 G$ w, T
# F9 Y; I) ^( O6 J, g' b' z, A: E fprintf( stderr, "%s\n", message );
7 j. A b! _9 M! N: q8 J }
% h/ z9 E5 Z4 X9 `}3 x1 o3 p5 b6 G1 H# F' e7 W; R2 i
以上代码编译之后显示
: v3 K! ^: P$ r' a3 W: G9 Ld:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int
) e! Y4 D/ y9 V2 Zd:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
. M; Q% d$ W7 C- q( U0 a$ q自己怎么都解决不了,不知道哪位大哥可以指点一下小弟
/ F0 N1 _6 a9 ]8 {7 h8 r: Q, K
6 t5 t& \# K& V |
|