🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #3384

Re: Bizzaar problem when calling EnumWindows API function.

#3384
From: David
Date: Sun, 18 Jun 2006 14:25
62 lines
3278 bytes
Thanks

I tried this but still no go.

If I cast the parameter I don't think there will be any problems although I 
don't like doing kludges like this :-(

regards
david


"Ed Mulroy" <dont_email_me@bitbuc.ket> wrote in message 
news:449552e8$1@newsgroups.borland.com...
>> EnumWindows(EnumProc,0);  // this call causes the error
>>
>> [C++ Error] App.cpp(91): E2034 Cannot convert 'int (__stdcall *)(void 
>> *,long)' to 'int (__stdcall *)()'
>> [C++ Error] App.cpp(91): E2342 Type mismatch in parameter 'lpEnumFunc' 
>> (wanted 'int (__stdcall *)()', got 'int (__stdcall *)(void *,long)')
>> ...
>> !!What on Earth is going on ??
>
> I think that is due to differences in the Windows header files.
>
> Long ago when MS only supported pre-ANSI standard C compiles did not 
> support type checking of calling arguments.  Functions were prototyped 
> without calling arguments.  Later they added C++ which requires that 
> ability but it broke builds of old, legacy code.  To handle that they 
> added the macro STRICT to cause function prototypes to be more strictly 
> interpreted.  Since Borland must license the MS header files this facility 
> to support a problem from 16 bit Windows continues to this day.
>
> Try putting this on the first line of the source code file:
> #define STRICT
>
> .  Ed
>
>> David wrote in message
>> news:44954617$1@newsgroups.borland.com...
>>
>> When I use the same module in one project I get the following errors when 
>> I call EnumProc as though it is expecting a different type of function 
>> pointer. But in other projects it is OK. If I cast the function pointer 
>> too what it thinks it expects then things are OK but I shouldn't have to 
>> do this !!What on Earth is going on ??
>>
>> Thanks in advance
>> David
>>
>> BOOL CALLBACK EnumProc(HWND h, LPARAM lp)
>> {
>>  ........
>> }
>>
>> EnumWindows(EnumProc,0);  // this call causes the error
>>
>> [C++ Error] App.cpp(91): E2034 Cannot convert 'int (__stdcall *)(void 
>> *,long)' to 'int (__stdcall *)()'
>> [C++ Error] App.cpp(91): E2342 Type mismatch in parameter 'lpEnumFunc' 
>> (wanted 'int (__stdcall *)()', got 'int (__stdcall *)(void *,long)')
>
> 
Technical Details
Message-ID: <44956252$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44954617$1@newsgroups.borland.com> <449552e8$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,4e294185b67adeb4
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "David" <davids@unite.com.au>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <44954617$1@newsgroups.borland.com> <449552e8$1@newsgroups.borland.com>
Subject: Re: Bizzaar problem when calling EnumWindows API function.
Date: Mon, 19 Jun 2006 00:25:20 +1000
Lines: 64
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 211.26.206.233
Message-ID: <44956252$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1150640722 211.26.206.233 (18 Jun 2006 07:25:22 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail