|
程序的目的是通过对话框给工作部件添加一个文件属性。编译时提示错在红色部份那里。不知错在哪里,请高人指点。" N0 D$ P; l& |. [( P2 r
错误提示:(error C2440: 'initializing' : cannot convert from '' to 'int (__cdecl *)(int,void *,struct UF_STYLER_item_value_type_s *)'! k r) B5 N' i4 o% q" ^
None of the functions with this name in scope match the target type)
( A. s3 k; P, B$ y1 x6 e. G( D9 P
- O, S9 z w3 z; ~/ u* w! u( u下面是程序内容:
, ?: N5 s* L" C0 S ?( f3 D) a#include <stdio.h> ! i* \9 k/ v4 h& l9 Z% y
#include <uf.h>
0 Q. v- c2 b2 C' C#include <uf_defs.h>
/ c6 w% T! M* D: W, E3 w! W#include <uf_exit.h>2 Y* m! v3 v/ ^. q
#include <uf_ui.h>
3 W, }/ {7 ?/ b) P8 D#include <uf_styler.h>
' f" z, B1 v4 O F: q, @0 ]#include <uf_mb.h> ; f9 c% r; q3 b3 q! z
#include <uf_part.h>5 a: M3 P+ N6 ~; U f) `' I; m4 X
#include <uf_modl.h>
8 }# v* x5 M# O ?#include <uf_attr.h>
" r5 y: U/ V& T6 E) c#include <uf_cfi.h>$ U( V/ C% j; m, @! m
#include <uf_assem.h>4 H+ s, Q2 e. j4 f; a6 |
r5 E, T8 v6 r" U
#define MY_TH ("TH")
8 B% R% ^( s6 c1 k#define MY_DIALOG_OBJECT_COUNT ( 1 )
$ F# ] d9 W- _' k: U2 J( h+ |
) [: ^+ P9 Z; F! Uint MY_ok_fun(int dialog_id,
' [0 R7 G% J$ B* ]9 V char *client_data,
, B1 m5 N) q. k8 o5 l8 a Q UF_STYLER_item_value_type_p_t callback_data); j- k5 ~) a" {7 C6 Y) j
/ J* W k0 Y. v2 M6 K+ z
int LaunchProDesignDialog( int *response );
: A' I$ G6 x) K. r$ Y9 K: Q, O4 ~8 U6 `3 u* F- B8 b7 Q+ C% {
#define MY_CB_COUNT ( 1 + 1 ) /* Add 1 for the terminator */$ K( B n) l% L
static UF_STYLER_callback_info_t MY_cbs[MY_CB_COUNT] = ! x* Y" E' u) B8 }) j
{4 r4 l4 |* r2 r1 i
{UF_STYLER_DIALOG_INDEX, UF_STYLER_OK_CB, 0, MY_ok_fun}, 6 b' J! z/ f- l
{UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
' h1 q+ Z. F: l0 } g) C5 \};3 [* B J0 ?' @. W9 U% a1 L! G3 ]- Z
5 \$ p: @8 a5 A0 @* T# _
) t5 A" q; b2 H$ f2 j7 f! b
static UF_MB_styler_actions_t actions[] = {8 Q4 r A4 K' U) e) T
{ "att.dlg", NULL, MY_cbs, UF_MB_STYLER_IS_NOT_TOP },0 ]) J c$ Q1 _" t- t
{ NULL, NULL, NULL, 0 } /* This is a NULL terminated list */. l# f. ^; I0 A" C
};$ f# m/ h$ N6 v% }& \% u
; g/ T1 C& `* O. Y+ l& L6 t, m5 n) b4 d) e3 c! _/ n: w
extern int LaunchProDesignDialog( int *response )/ @! R3 I6 F* s
{, r1 l k: a" J! Q
int error_code = 0;
) x/ J+ d! Y* `7 h% X B7 A 3 C' o# p: o6 g) L5 t4 x4 j
if ( ( error_code = UF_initialize() ) != 0 )
# A: m# n9 j x. z, U! [4 E return (0) ;
, C( _. t0 ^1 h3 s" F if ( ( error_code = UF_STYLER_create_dialog ( "att.dlg",9 O' J/ p/ s/ J
MY_cbs, /* Callbacks from dialog */3 \' q2 Q9 S0 c; q- y; E6 q/ _
MY_CB_COUNT, /* number of callbacks*/1 q$ X/ O8 p5 n7 z' I' q! \
NULL, /* This is your client data */9 j, a4 b+ U1 Z. p3 d
response ) ) != 0 ). y8 s! @5 p: B3 }! |7 s2 _3 C
{
! V2 L/ v- h$ y4 ]$ b! @) ] c+ U2 R char fail_message[133];
8 V m- `- y: @ /* Get the user function fail message based on the fail code.*/
/ a1 g' H! c. [9 |/ }) E UF_get_fail_message(error_code, fail_message);
8 c* ]$ |9 a2 _ UF_UI_set_status (fail_message);; |8 U( i# V; E, V' B; N8 z
printf ( "%s\n", fail_message ); 9 `( \- t# a, n$ x# V
}& ~0 y m3 O8 p5 N1 a
UF_terminate();
- N2 s2 T* l! ^* o return (error_code);3 E+ m! |/ D3 N/ f3 _ w# W
}9 |+ d+ q0 T" v
- {, C$ k7 {$ j6 P' H 4 ~# a4 B+ Z$ ^6 f) N8 e. c; J. }
int MY_ok_fun(int dialog_id,! Q. |( |" s' ?! A3 ^6 n2 ]
char *client_data,
# n8 O- X: c6 ~ C, Q' T* u* } UF_STYLER_item_value_type_p_t callback_data)
6 ^$ o3 m/ K* k, [4 A# C# n/ [ {# h. B5 k+ Y. T: U* `9 w
/ l; E0 k, Y6 f UF_STYLER_item_value_type_t data;9 d/ {& Y- q1 D/ h
UF_ATTR_value_t value;
- }% h6 x5 b: L6 H C) J - M0 I- }* d4 l
3 I# u, ^9 s" l
if ( UF_initialize() != 0)
' l J% m: q" |8 I& w return ( UF_UI_CB_CONTINUE_DIALOG );9 M, _! ^8 y- E& y
data.item_attr=UF_STYLER_VALUE;
1 z5 c% c% l* C3 B data.item_id=MY_TH;
9 D( G$ [9 p( i UF_STYLER_ask_value(dialog_id,&data);
7 F9 Q, V2 ^. k! n4 H) F: Q. H value.type=UF_ATTR_string;
' R4 S0 a/ M: A1 r3 A' r0 n value.value.string=data.value.string;% w0 k6 u+ l% D) z" D& `) ~+ o
1 K) x( C9 `/ ?2 g: K
UF_ATTR_assign(UF_ASSEM_ask_work_part (), "图号", value);
7 y; C) E7 \) \; Y7 j UF_terminate ();5 l( t" X) S% G) S& ]. R P5 @/ y; U
return (UF_UI_CB_CONTINUE_DIALOG);
T( p* w/ G9 s return (UF_UI_CB_EXIT_DIALOG);
- {+ | g$ V& @, a* R/ g5 r; l) J } |
|