|
程序的目的是通过对话框给工作部件添加一个文件属性。编译时提示错在红色部份那里。不知错在哪里,请高人指点。
1 Y# o2 q: K; _6 ?错误提示:(error C2440: 'initializing' : cannot convert from '' to 'int (__cdecl *)(int,void *,struct UF_STYLER_item_value_type_s *)'' m4 d, z) s4 F# F# v
None of the functions with this name in scope match the target type)
/ A7 Z8 @6 ?% N
8 T' _7 g* c' t- H* s8 `) W/ U/ j下面是程序内容:
) C1 y! e5 A* @/ j" Q#include <stdio.h>
8 I0 S0 W; x& C5 e5 Y7 H. A, L5 H#include <uf.h>1 \) _- h" ~; f* f' d
#include <uf_defs.h>" s4 p x0 J* x/ l% U
#include <uf_exit.h>
' a0 f4 T8 k6 ` e#include <uf_ui.h>: x& Z% z: e, Y v+ t7 D- P
#include <uf_styler.h>3 ]8 g& g" |; R% _% H, e/ P8 E
#include <uf_mb.h>
, g( S8 A0 x0 h5 l9 ?$ y#include <uf_part.h>9 p" V5 h$ R$ m6 d9 Q7 m- N
#include <uf_modl.h>
) y0 D* _% m1 A0 E3 E1 | F8 I#include <uf_attr.h>4 e# u' \; Z1 w2 f4 Z: O! S. ?8 p
#include <uf_cfi.h>
4 b- L' `! E' E: \5 {& g( R#include <uf_assem.h>
8 h" T. Q! A) A+ |7 \ Q P( i5 P, y# x; E
#define MY_TH ("TH")
! }* J" M# M% F5 \' d/ u6 `2 e- M#define MY_DIALOG_OBJECT_COUNT ( 1 )2 g2 r. R2 J- k3 _
! x: w9 r8 g* A; N2 cint MY_ok_fun(int dialog_id," p$ b6 O0 j0 Y, f- z: L' B7 \+ U O
char *client_data,) V/ k1 X: _3 x2 i
UF_STYLER_item_value_type_p_t callback_data);
6 {, i5 d; [# e% w( C* f% n- i$ g# O) c( S$ B, ~
int LaunchProDesignDialog( int *response );7 \6 S" J/ p* ?, |6 |
0 _ w- i: i0 e" t e8 }1 S
#define MY_CB_COUNT ( 1 + 1 ) /* Add 1 for the terminator */
7 C( N P& k# b& ]! A1 N' Hstatic UF_STYLER_callback_info_t MY_cbs[MY_CB_COUNT] =
3 a* f/ q! `$ a{/ V8 b$ Q$ \( _
{UF_STYLER_DIALOG_INDEX, UF_STYLER_OK_CB, 0, MY_ok_fun},
, Q: ^! ?; R3 d6 ~ h, @& e {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
1 i7 R1 N7 l/ L2 c7 J};
: n5 p. a; F. h9 z6 p2 A3 w
7 y) v+ j) O5 P8 N5 Q8 z% b# o8 }% z) p
static UF_MB_styler_actions_t actions[] = {4 r! g5 f8 [. A3 `& W
{ "att.dlg", NULL, MY_cbs, UF_MB_STYLER_IS_NOT_TOP },+ @' e2 V$ {( A7 s# P. g% J
{ NULL, NULL, NULL, 0 } /* This is a NULL terminated list */
+ c7 @+ w! p7 _4 M% |4 e6 I$ ^, B};, X2 U; m3 G- g- D* p* x1 V5 A
8 u7 d) }8 v- a9 K8 ?1 s% [% P6 ~: J0 w9 d2 s# o
extern int LaunchProDesignDialog( int *response )
6 L( ~( N" v3 M{& V% y- M2 C. C
int error_code = 0;
" ^( y0 E" e8 _" b% \% y . E9 ?7 ~$ m# @7 u! K* e
if ( ( error_code = UF_initialize() ) != 0 )
) o3 }7 y7 r+ l9 x0 R; H return (0) ;
, b2 a D6 @2 e) S2 Z; Q if ( ( error_code = UF_STYLER_create_dialog ( "att.dlg",* d0 O- e3 Y* z
MY_cbs, /* Callbacks from dialog */
) l0 \- x& P3 i" N- |+ A) }9 N MY_CB_COUNT, /* number of callbacks*/+ @1 Y, \0 _0 }
NULL, /* This is your client data */# F6 P+ J7 _: Y
response ) ) != 0 )+ ?, Z7 g' l% e5 C- a* j+ D
{* h" ^/ D7 t- X8 ?+ v+ K! R5 Z1 g
char fail_message[133];, T1 C' d( j# y% m
/* Get the user function fail message based on the fail code.*/
1 r, g7 q1 @8 t UF_get_fail_message(error_code, fail_message);+ u9 c+ T0 v2 U6 V; a: E4 }: m2 T
UF_UI_set_status (fail_message);2 M( }& Z! \6 s" {! K/ Q
printf ( "%s\n", fail_message ); - ]( {2 g) v' J3 J- |6 P
}
" V6 O7 _- s# ?+ ?: R4 Z UF_terminate();
' ]. m6 k3 G3 k H4 d' C return (error_code);) O q, `, _1 y
}
0 @; l* ~* B$ K' K
0 S0 F1 Z; s9 B$ P* w+ J
, U' w. |9 `4 m- S7 j, Q0 P int MY_ok_fun(int dialog_id,
5 k0 F9 g& B% ^- N- s char *client_data,
: ?7 e, [- q0 |: q' T8 g& B UF_STYLER_item_value_type_p_t callback_data)
. o; C- |& T# Y4 U1 ~8 X1 N {& q r+ ~0 Z) b' l3 {0 Y* |
, K0 `7 `2 _% [) W
UF_STYLER_item_value_type_t data;$ Z! `# p/ e1 J) V2 M8 y& e: J
UF_ATTR_value_t value;3 d) h( }7 B# i$ Z3 N
3 t" w% R& b: @: Y
3 l7 C# Z! E3 ?( \. T- m if ( UF_initialize() != 0)
, b+ c, q! K) b# O5 k return ( UF_UI_CB_CONTINUE_DIALOG );
. J+ L5 |3 }3 u data.item_attr=UF_STYLER_VALUE;! r# C" r% }5 x+ q
data.item_id=MY_TH;
2 |6 r* h$ h8 k3 e( l UF_STYLER_ask_value(dialog_id,&data);
" `% V/ [( i/ ~2 j value.type=UF_ATTR_string;3 w& u R3 Z& Z# y2 ^6 F) d
value.value.string=data.value.string;
9 G! ]6 q+ R1 J/ Y c$ X6 h1 l
, t, T, U/ k$ U- ?2 V UF_ATTR_assign(UF_ASSEM_ask_work_part (), "图号", value);
9 P/ I4 t H$ t: ?# v1 d; d# O3 N V UF_terminate ();0 N c& A- [/ a( w# U
return (UF_UI_CB_CONTINUE_DIALOG);; R( D9 E/ Z/ J! [ X, M
return (UF_UI_CB_EXIT_DIALOG);# n( w3 `- X- L+ i5 e0 e
} |
|