|
程序的目的是通过对话框给工作部件添加一个文件属性。编译时提示错在红色部份那里。不知错在哪里,请高人指点。
$ V7 w, S! H% }: `# L3 X$ t错误提示:(error C2440: 'initializing' : cannot convert from '' to 'int (__cdecl *)(int,void *,struct UF_STYLER_item_value_type_s *)'
$ p0 J8 m5 V! Y: B None of the functions with this name in scope match the target type)
3 F5 h' Q2 o( c' `3 {$ y& W
4 [4 y. [7 r" s下面是程序内容:9 w# o. M! F7 | `% X; z% ?* o/ [
#include <stdio.h> / ?# ]! g3 M( o, g+ R2 Y
#include <uf.h>
0 D( ]; X+ n- F3 ~#include <uf_defs.h>
3 {4 W5 L' T" O3 h#include <uf_exit.h>
8 v: y* T" b% H#include <uf_ui.h>% {7 H2 x1 X- N2 {) I% ] |6 B
#include <uf_styler.h>& m P7 M3 g+ W6 l
#include <uf_mb.h> : M" X$ o& d5 A' c% h
#include <uf_part.h>
% Y6 J; J+ A4 X% p* s) @#include <uf_modl.h>
) p9 H* [" }4 P* e3 ^! i: P#include <uf_attr.h>3 v1 m$ Z8 k! f7 ]
#include <uf_cfi.h>
% n4 ~4 U/ c$ n9 }1 B, H2 c( Z4 {, j#include <uf_assem.h>
% _% P& F: I3 r& k( b5 }3 F. Y( j& [+ |/ { L6 |2 ` O
#define MY_TH ("TH")( _, l5 }4 X4 v! k9 \% N* {
#define MY_DIALOG_OBJECT_COUNT ( 1 )
: r& e9 M' b' B% c- B# k- j( D * K; C% n6 H) `' ?9 v
int MY_ok_fun(int dialog_id,
- L: N' z( O) v" f# S0 J char *client_data,
$ z+ T# b# E$ ?- c# C# N ] UF_STYLER_item_value_type_p_t callback_data);: ^# p; ], B% _: W5 L
7 b: O3 {% s7 A% L8 [1 m int LaunchProDesignDialog( int *response );
% W4 K5 j+ S0 B) G- n' {1 H, X: v2 W& \
#define MY_CB_COUNT ( 1 + 1 ) /* Add 1 for the terminator */
+ w6 P, f& G$ lstatic UF_STYLER_callback_info_t MY_cbs[MY_CB_COUNT] =
1 M. _2 {+ O6 K2 B3 i{
2 M1 L2 P4 Y: u {UF_STYLER_DIALOG_INDEX, UF_STYLER_OK_CB, 0, MY_ok_fun}, # n3 M( }: I4 f# ?8 I
{UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
. n) _, V) M) R};
) f1 a2 R" T: O+ S$ z7 R; v
2 h" ^. B" |2 q' i# P# H& v% I( w5 J) C
static UF_MB_styler_actions_t actions[] = {/ u, `$ N# D9 z. w* t! t
{ "att.dlg", NULL, MY_cbs, UF_MB_STYLER_IS_NOT_TOP },
: y3 q3 O9 |4 h- I0 s% _ { NULL, NULL, NULL, 0 } /* This is a NULL terminated list */
/ A* w( N! g. e( o};2 t6 v1 w) C1 p) w2 _$ m
9 v; y4 E9 c1 d, k
( P3 J5 L2 N6 {1 C4 n$ oextern int LaunchProDesignDialog( int *response ). _9 E! |$ `8 j& B2 t+ G2 @8 b {
{
# R4 i6 z0 ?' Z; A+ s; y+ b& _. g int error_code = 0;
4 r, R6 n, R- S: ?
8 d- f6 _2 s& x/ ?% y if ( ( error_code = UF_initialize() ) != 0 ) * n/ ?' ]8 Z$ ^' m
return (0) ;: |, _2 \- \2 k. T* C P4 n& t8 q
if ( ( error_code = UF_STYLER_create_dialog ( "att.dlg",5 a$ o1 t1 R o# y. N8 U! O5 n
MY_cbs, /* Callbacks from dialog */
X$ C7 [ L2 w5 k' ~; G MY_CB_COUNT, /* number of callbacks*/3 P; |5 z- ~9 R6 G: [1 Y( g
NULL, /* This is your client data */1 C- f+ g ?, i: o, ~) e$ n+ b5 S
response ) ) != 0 )
4 x- [2 J0 u+ _" k. Y, Q {
# F6 h0 v. ~( \' l char fail_message[133];3 k/ Q. k) M7 q# ]6 Q
/* Get the user function fail message based on the fail code.*/
4 I2 ^. a( L" m: ?! j UF_get_fail_message(error_code, fail_message);$ y5 L' ~. K+ n3 N9 ?
UF_UI_set_status (fail_message);/ z1 j( [% \4 r5 W- ] ` z
printf ( "%s\n", fail_message );
( q3 ]' w6 v" i' k}1 x) E% f6 o' H
UF_terminate();
) s" i& f% s& D: r% A4 z return (error_code);
$ `- P' F, T8 T: a}6 A* _* t4 Q0 r R! L
- u0 M; E( B; q6 W* Y
3 n0 Y6 I# Q3 q7 X4 d int MY_ok_fun(int dialog_id,# `$ B; F0 V0 T9 J
char *client_data,
K/ e: T$ X. q UF_STYLER_item_value_type_p_t callback_data)+ B- `/ h, E8 |* A! c
{1 r7 N/ W2 w2 V3 e% x" r0 T
/ h. y) y4 t5 ?0 } UF_STYLER_item_value_type_t data;0 Y$ s- c, E7 [* `5 M
UF_ATTR_value_t value;$ ]; f, H$ X$ l
: A& s$ b8 I# u' |) d, Z
; c5 C* p- n* d* }4 f9 @ Q if ( UF_initialize() != 0)
+ i* ^/ A- ^ V+ U5 T return ( UF_UI_CB_CONTINUE_DIALOG );
; C; O: t8 ^3 g6 F) U0 \5 I data.item_attr=UF_STYLER_VALUE;
2 Y0 |' j! K3 a4 U2 D data.item_id=MY_TH;% Y$ q# i2 I% K. R( l C2 o
UF_STYLER_ask_value(dialog_id,&data);
) y4 P0 t, o) B: g$ e value.type=UF_ATTR_string;
6 N4 z' T( W0 ] _ value.value.string=data.value.string;
: y- J, E0 Z# s" Q# Y/ k o 2 {/ z0 `& n) \7 I i
UF_ATTR_assign(UF_ASSEM_ask_work_part (), "图号", value);
2 ~9 o% V+ |; w. {. t! K" g UF_terminate ();: r3 X, G& Y0 ^ @# @# H
return (UF_UI_CB_CONTINUE_DIALOG);' y V$ b6 k# w0 V& `* u
return (UF_UI_CB_EXIT_DIALOG);% g$ ~4 ]+ g9 Y1 @
} |
|