|
程序的目的是通过对话框给工作部件添加一个文件属性。编译时提示错在红色部份那里。不知错在哪里,请高人指点。! j" h/ T; ?5 z! }" b+ F
错误提示:(error C2440: 'initializing' : cannot convert from '' to 'int (__cdecl *)(int,void *,struct UF_STYLER_item_value_type_s *)'3 { v. `% E0 l+ `7 G
None of the functions with this name in scope match the target type)
' m$ D( |' l% |. t
% q7 V4 X; v& M' ~# g下面是程序内容:
- D* ]' L5 t! W) O9 i3 X#include <stdio.h> . q! B& b- e3 @% u3 f7 B2 P6 \- y
#include <uf.h>
2 G) s- n2 E+ {, i/ o( v#include <uf_defs.h>% j9 w: m8 |4 g0 _6 P$ a6 ~
#include <uf_exit.h>' Q, j5 Q% Y4 ^
#include <uf_ui.h>
7 u Q% v: W( a3 T% v9 }1 c- |#include <uf_styler.h># J, E. p- ^2 h* S
#include <uf_mb.h>
2 @1 } T3 Y5 f, Q/ @1 N( r E#include <uf_part.h>
: e) `! }: K$ k$ c7 w, E#include <uf_modl.h>
/ p1 L# ^# Q' t4 J) C6 `#include <uf_attr.h>& r) J) j3 K% x& t
#include <uf_cfi.h>( j H" O9 ^+ t
#include <uf_assem.h>
% W% m8 G1 G; l( n; B7 B2 y' g+ e' m# ~" D* f* G+ w
#define MY_TH ("TH")
1 i+ U* S) u/ |1 ~; z4 E% W#define MY_DIALOG_OBJECT_COUNT ( 1 )
/ e: ?0 m5 u8 r/ @ r+ \ # t3 F" G8 I8 W' [: C: W1 A
int MY_ok_fun(int dialog_id,! h( Y7 J+ K. ]7 h( U: f+ [
char *client_data,
; w8 c& q" [, G) ^ UF_STYLER_item_value_type_p_t callback_data);# n8 J3 Z9 K% D: T C, y v# ]4 ^/ r
+ n5 K r: P0 f7 b+ ` int LaunchProDesignDialog( int *response );/ i6 z/ q: z% o+ i# C, d4 T
' x* ~% y7 S0 `5 Q) ~4 e
#define MY_CB_COUNT ( 1 + 1 ) /* Add 1 for the terminator */
! o. e& G# v0 d3 a1 Jstatic UF_STYLER_callback_info_t MY_cbs[MY_CB_COUNT] = 3 @* g* J1 q9 Z p6 \3 J
{: y' w% E) [; V6 [1 Z5 b8 [! R3 {* c
{UF_STYLER_DIALOG_INDEX, UF_STYLER_OK_CB, 0, MY_ok_fun},
) X" U- _; X7 z1 v9 |/ } {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
6 t& V* x( B0 H% L6 ?2 Y, A};
# G) G8 r _( p2 j, {1 n/ e- ?
9 E) m2 f4 W% z1 {2 y3 Y0 g: M+ J+ m+ J1 H! t$ O
static UF_MB_styler_actions_t actions[] = {6 l" W( B$ G/ Z4 L- s) h
{ "att.dlg", NULL, MY_cbs, UF_MB_STYLER_IS_NOT_TOP },+ b+ T+ d' B5 _8 T
{ NULL, NULL, NULL, 0 } /* This is a NULL terminated list */
, M( o+ B1 V# j! b! e: m: C6 e# k};
% D. s( W6 e8 o# o+ X% ?* K" M0 r9 I3 Y; N- z' v* r- ]
& h2 D; q' r m" Y- u6 u
extern int LaunchProDesignDialog( int *response ) R- q2 L& k! u1 c! T
{+ M/ G8 x& o$ B5 T+ o- c
int error_code = 0;% S$ i" B7 W, B% N$ e3 v
3 [% A9 Z$ ?- P6 S" g
if ( ( error_code = UF_initialize() ) != 0 ) 0 F- N4 A" Z1 e4 T' N
return (0) ;$ `/ V2 q& h3 s% l) G6 ~: ^
if ( ( error_code = UF_STYLER_create_dialog ( "att.dlg",
* ^) Q- S! q( L! H MY_cbs, /* Callbacks from dialog */
# _/ k( K# E+ m7 \' c MY_CB_COUNT, /* number of callbacks*/( d4 l9 o8 s& i: J% {
NULL, /* This is your client data */
$ ~0 m: n9 K% g4 z6 B# `$ x response ) ) != 0 )" V2 o1 u4 u: X1 V/ l9 c6 R
{, ~1 T. r- B( o
char fail_message[133];
/ N! R9 _0 a1 E) G8 K0 }' X /* Get the user function fail message based on the fail code.*/
1 X7 M3 Y. Y, t9 z, s, e5 l% Z UF_get_fail_message(error_code, fail_message);
7 }5 j9 q D' A$ @2 y" R/ |* l# _, R UF_UI_set_status (fail_message);, T- }4 ? g# \; o
printf ( "%s\n", fail_message );
! l: o* R; i7 k}
5 e) A3 W: F1 r+ |! S; u2 Q( t UF_terminate();
3 b8 N* b' Q& k& g6 P( { return (error_code);- J: ]2 ]6 E b* T2 ` r
}1 V( k( D( c" }( A9 }( X
% d6 W8 j- F7 B6 _ % @& P* A6 B, ?' Z/ t6 k6 t# Q
int MY_ok_fun(int dialog_id,: J: z+ x: e6 D2 d5 O
char *client_data,
3 }# Z/ C* M& y( P UF_STYLER_item_value_type_p_t callback_data)2 I5 H$ G1 \# _% L9 l2 F5 J
{# I- z; L" u& c1 T
% w6 x+ Q5 D: } N0 b/ E( p s$ U& x
UF_STYLER_item_value_type_t data;
9 H4 s1 y6 `) j# {. s UF_ATTR_value_t value;3 p) L2 o* T, y. L7 q; N! X9 j2 E
$ u$ x% I0 Q: O7 O8 ]+ F ' t4 F3 @- z3 \$ J$ j( {* e
if ( UF_initialize() != 0)9 a) U- e5 z2 I+ h
return ( UF_UI_CB_CONTINUE_DIALOG );$ m* w' `7 @7 [
data.item_attr=UF_STYLER_VALUE;% m i$ X1 T5 q; `: I0 [
data.item_id=MY_TH;3 h- Z3 y) {0 N
UF_STYLER_ask_value(dialog_id,&data);
! ]6 F- q R" {3 q6 i value.type=UF_ATTR_string;
6 L8 R4 V' F# ] P1 A- X value.value.string=data.value.string;
) S+ t: _+ Z& @8 e! u) b3 E2 N 3 l3 D W3 d p' I
UF_ATTR_assign(UF_ASSEM_ask_work_part (), "图号", value);" ^8 i# R- ^4 H- l( l8 q' Z
UF_terminate ();
1 W: G% d$ W" N2 g* ^% Z+ r6 { return (UF_UI_CB_CONTINUE_DIALOG);
( p2 a% L& t9 L) c* ^! A8 A return (UF_UI_CB_EXIT_DIALOG);
$ b0 }* U8 @; F, d5 L$ B } |
|