|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>7 D+ }! W+ _4 r3 ~2 n' I! G
#include <uf.h>* }8 N' [9 H: e7 _% @
#include <uf_ui.h>8 t$ y! [7 _: H; r; a4 n* x1 c# }
#include "UG_UI.h"
, X3 ^+ a5 H6 ]: O( Z2 u#include <uf_mb.h>0 q1 P8 V% U. I5 l
#include "UG_UI_calculate_dialog.h"
; B3 |/ G' S5 W4 p' d6 K; K# {: S2 \; ^5 p& t5 F+ @
/*****************************************************************************
1 F# @7 H2 {! c, i$ H** Activation Methods# V( z$ B/ y5 y# J! Z# A
*****************************************************************************/
2 x; t. x, U! z( K Z8 J
5 W. x& L! j6 m% K8 z& X! m/* Unigraphics Startup( w( ~8 x' P7 W2 o% Z2 q# i3 \
** This entry point activates the application at Unigraphics startup */
* ?' P* ~# e0 k" x( n% s* wextern DllExport void ufsta( char *param, int *returnCode, int rlen )' F9 H0 N) {/ d* i) V" r# x
{. V4 a6 f1 J/ U' z+ Q; c
/* Initialize the API environment */
* m+ H8 J. S6 G static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
4 E+ G" W5 p8 \8 }) m% Y UF_MB_data_t,UF_MB_activated_button_p_t );$ j9 c& [1 y" W9 r6 p
static UF_MB_action_t actionTable[]=
/ ^0 Y- {& d7 j! T; t4 F {
; U" ^7 R$ g& W2 C/ n& P! U* t$ a {"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},
( \/ ^/ N# X- S3 G+ y {NULL,NULL,NULL}
0 N/ w4 q% L6 o };% C; T: }" s0 x. ]: I# j1 N% K
int errorCode = UF_initialize();1 ]3 v N5 y+ o/ M$ }
if ( 0 == errorCode )7 y6 Y" F8 a7 y. j; h4 m
{
- ]0 b1 } W4 C2 | UF_MB_add_actions(actionTable);
! c5 y' ^1 w- n6 m. |& o errorCode = UF_terminate();
7 J8 V, u( _- v7 v( [ }6 k; R& @4 E, D% _0 ]& c7 J
PrintErrorMessage( errorCode ); W& M1 Y( X8 c5 C; b: c$ e, X: n
}
/ c9 k; d# `& x! V, E* _0 i& x _. o, g: a' ?1 M
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun(
5 N! o0 @6 w8 B. C. |- E8 Z1 C UF_MB_widget_t widget,& K7 l/ n$ Y2 ~3 d1 b, C
UF_MB_data_t client_data,
1 Z/ G9 w; r& k* b UF_MB_activated_button_p_t call_button
; C/ W3 v6 c1 l3 y v6 c+ z1 F$ U9 ^ )
* w, k# ~! V v; x/ e* R( {{4 Z1 B+ _% m* Y- j2 o
UG_UI_calculate_data m_data;0 X% ^' L8 f5 s% Q/ X. W
int response;; D! P- g4 E, k+ }% T4 y% o
LaunchCalculateDialog( &response ,&m_data);
. G1 c: b+ c+ W. M; R# p! m return UF_MB_CB_CONTINUE ;) R$ b7 ?+ m$ u0 ~" l; _! t
}
, s5 f) s7 K: T$ S# q+ r1 U/*****************************************************************************
1 o% ~! G8 J8 A5 _** Utilities" z. S: y- F1 a7 \/ r& k
*****************************************************************************/& _( Z d* C4 E' l. C5 w% y
7 Z" W: m ^; o3 s/* Unload Handler$ w7 m' C% L% |; u2 m( ^
** This function specifies when to unload your application from Unigraphics.4 t3 I/ n6 m7 N
** If your application registers a callback (from a MenuScript item or a
/ N. P3 b" l) ?8 }9 |) p! l) X** User Defined Object for example), this function MUST return
. d; C9 e# z( w( b! M! m- i** "UF_UNLOAD_UG_TERMINATE". */% p/ r% B) q' B: \. C
extern int ufusr_ask_unload( void )$ y( T/ S& `1 a" |$ S
{8 x' K( e4 U3 p0 |; l
return( UF_UNLOAD_IMMEDIATELY ); w8 E: I- f0 A5 s
}
% V g+ _- S4 ?9 q7 @
4 @; V( N) p7 M- U$ W% e/* PrintErrorMessage f& `2 y' H, b1 @: b, g
** ~+ y X$ h7 U1 F. A* Z' D% `1 y
** Prints error messages to standard error and the Unigraphics status8 u1 e' J! u+ J/ i4 g/ c
** line. */4 E3 o2 H" {3 I' ~, W+ ?7 a) J
static void PrintErrorMessage( int errorCode )
9 K$ n$ @ A/ U- R{) R- ]/ [6 L9 |! e2 Q( l
if ( 0 != errorCode )1 U4 q/ N, k9 R7 P
{
2 r6 v8 Z# i8 y( z /* Retrieve the associated error message */1 h: ~+ O5 U1 f+ t
char message[133];' A( D1 |# { s% S$ u$ i; o2 ~8 |
UF_get_fail_message( errorCode, message );
+ k/ u4 H) _9 ~2 K$ {2 G4 O
! q! S+ t8 X. p- f /* Print out the message */
7 v: k- Q* o! w! y5 n7 X6 D$ p8 _; l UF_UI_set_status( message );
4 ^5 K- g/ I& T# k. n) O5 _* m6 g- N: j% b
fprintf( stderr, "%s\n", message );- o X! g' N2 w' ?( f4 D
}
* w2 U4 s% v0 F3 i5 j}# A5 D+ P1 j R3 [+ r- G
以上代码编译之后显示2 `. }4 v; O; y* t
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int
; t% L1 E0 e' o! Y8 Z) k2 D: kd:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier3 [. F4 m" }& Y" I, p+ m9 W
自己怎么都解决不了,不知道哪位大哥可以指点一下小弟) s: a0 ^8 d7 M% F- y
/ A% N4 w" s( q% O
|
|