|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>) |4 D( E4 f5 X& [
#include <uf.h>
4 f/ }8 f* y" ~! y#include <uf_ui.h>
3 Z/ S4 |# ^) d#include "UG_UI.h"
$ t+ R9 j3 v+ @" C+ x& ?2 W0 Y#include <uf_mb.h>
& c0 z; P% D9 G8 \! U1 e$ C/ ?#include "UG_UI_calculate_dialog.h" ` k9 _: D8 X: r7 r! ~! d/ F% V
# m) U) N" _0 `# Q/ Z/*****************************************************************************
2 I5 Q. C- d* E** Activation Methods
+ S7 w, a% i) y* o; [) ?0 O3 f*****************************************************************************/
r2 A, r) Q2 L" b7 l! G5 ]! z6 N8 p+ v' z/ o! i) {
/* Unigraphics Startup
0 L% A6 @" {2 B+ Z8 o** This entry point activates the application at Unigraphics startup */ Q7 b. f4 _8 q5 d
extern DllExport void ufsta( char *param, int *returnCode, int rlen )
( S" G0 |& M4 _& a; Q{" N! B# q. ]' C" C+ A/ ]! W
/* Initialize the API environment */
8 Z0 w. ?' V# p. c static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
* M; R; O2 K- k1 m0 ]1 y& } UF_MB_data_t,UF_MB_activated_button_p_t );
/ V* v1 D% ]/ X& }! W static UF_MB_action_t actionTable[]=* O# n9 Y* g3 s1 g- o- H
{
9 p' M) l" m4 B/ k9 W' y {"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},2 X7 D8 ?1 }" j. C* p" t
{NULL,NULL,NULL}- @8 B+ _, h2 H% T9 G: Y" d! X. M
};
( [( J& K9 m0 c! D( K- g/ | int errorCode = UF_initialize();
8 I" w) a, J1 }) ~. j' A2 P$ _ if ( 0 == errorCode )
/ g8 @: ^' {1 h( n( I/ @# z9 V* O+ O {7 U) Z7 `$ ~" a" i
UF_MB_add_actions(actionTable);8 Q) M+ W* A. T7 [! |8 r; b3 j
errorCode = UF_terminate();
' f/ L; L6 Q# S, G0 y+ [, x8 V }
2 V8 v$ q. B! h) n% m. [ PrintErrorMessage( errorCode );
# I. t+ ]! G$ Q6 D/ U}
& {" f! O* U5 l+ T2 [5 R6 |) o
4 l" c, }1 A1 o! |static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
4 R* h' r( \* J' V% n$ d: \, W: p UF_MB_widget_t widget,
9 G% V! l& ~1 `9 J2 } UF_MB_data_t client_data,
( w- n/ U$ @# ^2 s% V UF_MB_activated_button_p_t call_button2 T( Y! f4 d# k7 H" p
)
! I' k- X3 M. m# z1 K Q, E{; b: b, P3 e. m6 o( r
UG_UI_calculate_data m_data;% \1 ^8 J# e5 u3 n+ q$ F# |2 O
int response;, B- H' [9 |& @5 R
LaunchCalculateDialog( &response ,&m_data);
& N' S8 S% G7 } return UF_MB_CB_CONTINUE ;
; Y, ~. z: T/ A) U}0 T( r/ O, }" U% t' s0 ? Q
/*****************************************************************************
: _8 U2 o7 }4 O: ]+ n$ Y** Utilities+ k. `1 _5 w) Y) V2 ?$ X
*****************************************************************************/
7 I6 h9 z6 b" I9 s: o; ~ l4 I' W/ d, A+ L9 p, r# t; L
/* Unload Handler7 ^) m3 E+ I: g8 E
** This function specifies when to unload your application from Unigraphics.
7 @9 S+ [/ I, ?+ g6 n** If your application registers a callback (from a MenuScript item or a
! F0 M! S% Z. g; i' L( x: E2 G7 }** User Defined Object for example), this function MUST return
1 X+ X& L) c4 s9 H7 ?2 R1 a** "UF_UNLOAD_UG_TERMINATE". */
. ]" |- g% q! f4 ?% J1 |# l1 q% _extern int ufusr_ask_unload( void )$ Q; Y: Q: z4 s4 O( V
{5 [' p- |3 a3 U; D6 X" v0 o+ b2 w4 B
return( UF_UNLOAD_IMMEDIATELY );
3 |. j. O! Z$ |- d: k}) E, j& K8 C' {
2 u, `7 \# X3 G' W% C! F( `/* PrintErrorMessage
+ s* e! f+ R- m% _**
4 L- |' T2 M- |** Prints error messages to standard error and the Unigraphics status
* L( ^! e: q" \1 P: z6 F1 ?# m** line. */3 R/ Y( \( B; g0 B1 p
static void PrintErrorMessage( int errorCode )6 o0 x& b- ~7 \6 ]; T/ m
{
% \# q/ i" ^4 I( f& [" N& v: A9 L0 d if ( 0 != errorCode )
& Y6 b( T6 K* X/ l {: A4 q7 n# s$ n/ `& B$ A
/* Retrieve the associated error message */
! F N6 H- M$ d1 g$ {8 t8 X! z# | char message[133];
$ ~7 E! x! [0 D3 ]# f, | UF_get_fail_message( errorCode, message );
* d4 W$ X% t3 ^ ~/ _" q5 R/ D7 [1 E) e- g- ^& K3 W
/* Print out the message */* g* F+ ^. `, B# R, ^
UF_UI_set_status( message );/ W# \2 [% P9 K9 n3 C5 t
2 q# {: N( ^0 _) ?+ R- q, r fprintf( stderr, "%s\n", message );/ C" `) _: S! W
}
- S) [* S, g- d}) K- y5 t: U+ |
以上代码编译之后显示
7 @! F) g) A) Q: w- ~9 c2 N9 j: F/ Ud:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int
6 [/ |: }# X& p; |d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier$ K& [; p% [. q( T7 r
自己怎么都解决不了,不知道哪位大哥可以指点一下小弟
( o7 o7 K& v: G) W3 u2 U( T% L0 z6 ~# P
|
|