Article View: borland.public.cppbuilder.nativeapi
Article #17397Re: DialogBox BUG
From: Remy Lebeau (TeamB)
Date: Wed, 26 Mar 2003 18:50
Date: Wed, 26 Mar 2003 18:50
40 lines
2238 bytes
2238 bytes
"ScOe" <sven.savic@zg.hinet.hr> wrote in message
news:3e81ef72@newsgroups.borland.com...
> I've encounter one BUG with c++ builder or something ...
> and i dont know how to fix it ...
That's not a bug in Builder, but in your understanding in how your own code
should work.
> i'm calling DialogBox function and for MyDialogProc
> fResult = DialogBox (hInstance, TEXT ("AboutBox"), 0, MyDialogProc) ;
> error code that i'm receiving is:
> E2034 Cannot convert 'int (__stdcall *)(void *,unsigned int,unsigned
> int,long)' to 'int (__stdcall*)()'
Your dialog procedure doesn't match the function signature DialogBox() is
expecting. You need to cast your function pointe when you pass it in:
fResult = DialogBox (hInstance, TEXT ("AboutBox"), 0,
(DLGPROC)MyDialogProc) ;
> I dont know how did he expect to get 'int (__stdcall *)()' when in winhelp
> is wroten that 'lpDialogFunc' expect 'int (__stdcall *)(void *,unsigned
> int,unsigned int,long)' callback function.
That is because DLGPROC has a different declaration depending on whether
STRICT is defined or not, which is not defined by default:
typedef int (FAR WINAPI *FARPROC)();
...
#ifdef STRICT
typedef INT_PTR (CALLBACK* DLGPROC)(HWND, UINT, WPARAM, LPARAM);
#else
typedef FARPROC DLGPROC;
#endif
Gambit
Technical Details
Message-ID:
<3e81f425$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3e81ef72@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,ca0d320e3b0653a0 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-03-26 20:40:10 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3e81ef72@newsgroups.borland.com> Subject: Re: DialogBox BUG Date: Wed, 26 Mar 2003 10:50:29 -0800 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3e81f425$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1048704037 207.175.226.26 (26 Mar 2003 10:40:37 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail