|
程序的目的是通过对话框给工作部件添加一个文件属性。编译时提示错在红色部份那里。不知错在哪里,请高人指点。
9 @ o1 f$ e' J) f- {- |0 S错误提示:(error C2440: 'initializing' : cannot convert from '' to 'int (__cdecl *)(int,void *,struct UF_STYLER_item_value_type_s *)'9 b4 c: r5 w( }3 M! _* }1 |
None of the functions with this name in scope match the target type)
1 r& T0 Z/ z7 `7 R1 P! |$ C# ]. Z" J% ^6 ^
下面是程序内容:, P9 [4 _ S" F a
#include <stdio.h>
( g5 U& P" f# }8 Q- L* L3 g#include <uf.h>
5 |) }+ w0 o3 W a4 r; O#include <uf_defs.h>% V! T# U( _8 H; z/ L! X/ ?
#include <uf_exit.h>
9 D( Q3 t6 B' K9 D. Q# J! J* C#include <uf_ui.h>) `, o6 \* f; ?* l5 x$ Z
#include <uf_styler.h>; r" g6 l `" Z1 g" \
#include <uf_mb.h>
2 y b8 w8 {& f: @ [$ o8 D#include <uf_part.h>
0 W" ~+ L1 F7 R# [/ ?#include <uf_modl.h>+ e# I1 k, B) T( X; s% s4 j/ P
#include <uf_attr.h># S4 {7 K3 V4 g- P$ o- {5 q
#include <uf_cfi.h>
7 d$ l) P4 q& T" o) J! }3 x#include <uf_assem.h>
8 f9 Y1 u3 r- R B; ~& i
1 H- G) m2 p9 p#define MY_TH ("TH")
6 }5 f* R, \/ N* ~+ n2 L#define MY_DIALOG_OBJECT_COUNT ( 1 )2 N# `+ X5 y$ P! t- }
) g6 p) J1 d- s; x+ P; S6 Rint MY_ok_fun(int dialog_id,5 V/ i+ [" A* u5 x, Z
char *client_data,
4 ~$ s. b$ I6 ^5 D: G UF_STYLER_item_value_type_p_t callback_data);* k# n% |7 z, @: Z
- n3 q7 [& G3 }% Z) j
int LaunchProDesignDialog( int *response );
1 G* s o* C8 A9 g9 c
7 Z5 X0 P- y' C#define MY_CB_COUNT ( 1 + 1 ) /* Add 1 for the terminator */
& i2 ]$ i5 }: p" ?& V' ?4 Lstatic UF_STYLER_callback_info_t MY_cbs[MY_CB_COUNT] =
( i3 ~$ } B# F ~) J& z0 E/ q& c{& A t; U/ Z Q: N. t7 @1 H2 [; g
{UF_STYLER_DIALOG_INDEX, UF_STYLER_OK_CB, 0, MY_ok_fun},
4 E8 y5 ]+ f/ v& {7 x* p {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }; Q9 j$ z1 w; `2 C C9 `
};9 Y9 d% ?# G7 u, G# c) ]
0 U U& F4 \+ K2 p* M
7 b- o: q* E- ?: H' Y0 l4 W$ I5 estatic UF_MB_styler_actions_t actions[] = {
! O. O/ _1 K# L { "att.dlg", NULL, MY_cbs, UF_MB_STYLER_IS_NOT_TOP },# J+ z# j, w4 X3 @+ G- |/ ]
{ NULL, NULL, NULL, 0 } /* This is a NULL terminated list */' s% {. R' Z m; s6 U6 r
};
/ [1 k& I0 ^( v7 W4 }) E
& a2 ?5 |2 h- l6 Q0 {8 B2 j
v' y! L* ^7 x2 q3 c6 m( a; N- U* A8 oextern int LaunchProDesignDialog( int *response )
. c1 l1 W6 R) K{
5 e1 f$ ]# B7 q) y+ u int error_code = 0;* d0 U( N- h% C7 Z
' T3 x& G7 G; O
if ( ( error_code = UF_initialize() ) != 0 )
) k' V4 \4 K) g& v return (0) ;! d2 P$ `5 k4 K( V9 x. w$ @( K
if ( ( error_code = UF_STYLER_create_dialog ( "att.dlg",
& f% o2 @7 E$ c8 o3 T1 S, e" a. p MY_cbs, /* Callbacks from dialog */
! `2 y9 _6 w' e& G1 @1 G MY_CB_COUNT, /* number of callbacks*/! r" P& D- e I7 A: f
NULL, /* This is your client data */
1 d9 S5 `, C/ S& R/ ~' f1 _# u response ) ) != 0 )" [9 ]3 r) b- \3 R% q
{$ Y w: Y# l- Z9 T
char fail_message[133];. ?% l5 s8 X8 W: S' R' D c x
/* Get the user function fail message based on the fail code.*/$ Z$ @- ?& R4 q( b$ x
UF_get_fail_message(error_code, fail_message);
$ b0 ]: [( M; S% S K UF_UI_set_status (fail_message);, E. ~8 B6 v+ O @) a5 x
printf ( "%s\n", fail_message ); $ l4 I+ O- c1 E! d1 o }& J) h7 u
}
8 ?) l2 i: c9 _, H* ~1 l- G UF_terminate();
& y, O( u' J% _ return (error_code);
# ^7 y; N* f {) G5 q& ?) e}, q" z; ~; r# P5 D
0 J! X/ j) A5 u5 G8 j% E
* J% I' U, G+ ?9 a9 i: V) m% q int MY_ok_fun(int dialog_id,
; Y0 N2 H8 {% x char *client_data,
; v* Q8 w7 s, i" m+ t, n UF_STYLER_item_value_type_p_t callback_data)
2 L5 Y' o$ f3 O% M- L {, X3 z( n) X; _/ d
" Q$ H8 j* I+ j. ~; k" M/ R+ Z
UF_STYLER_item_value_type_t data;& a' |0 F3 H6 k7 ]% W
UF_ATTR_value_t value;
8 Q& v; n2 R, P1 R / |: C9 P8 |# Y& X
5 O' u3 \0 f9 @8 B- b
if ( UF_initialize() != 0), o0 W( N6 f# O' I6 p
return ( UF_UI_CB_CONTINUE_DIALOG );( N0 v8 s3 t6 l6 [4 U" b& g
data.item_attr=UF_STYLER_VALUE;6 h! d* u3 A% K3 L3 |; r {; \
data.item_id=MY_TH;
4 P0 R9 c+ A6 e3 V0 R UF_STYLER_ask_value(dialog_id,&data);# L) b" y6 b, U
value.type=UF_ATTR_string;
; h6 f, f# A2 @- j; o Y8 }) H value.value.string=data.value.string;0 U2 y9 \+ c5 u
) J% m" o" R+ i6 M2 v5 L UF_ATTR_assign(UF_ASSEM_ask_work_part (), "图号", value);; Z( `! H7 U5 a9 l2 j
UF_terminate ();, q4 P$ `9 A$ \4 @4 W; u/ J5 b( d
return (UF_UI_CB_CONTINUE_DIALOG);
7 Z+ F9 r9 ~7 S* h return (UF_UI_CB_EXIT_DIALOG);/ b# g0 \* }4 ^4 A
} |
|