🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages Started by Dan Wed, 28 Feb 2007 17:16
Using EnumWindows in C++Builder
#2400
Author: Dan
Date: Wed, 28 Feb 2007 17:16
16 lines
1456 bytes
Hi, I am trying to use the EnumWindows function in a VCL application, 
however, I am getting an error:

"[C++ Error] Main.cpp(106): E2034 Cannot convert 'int (__stdcall *)(void 
*,long)' to 'int (__stdcall *)()'"

The call looks like this:
     EnumWindows(EnumWindowsProc, NULL);

My EnnumWindowsProc function looks like this:
     BOOL CALLBACK EnumWindowsProc(HANDLE hWnd, LPARAM lparam);

Which, I think, matches the Win32 Programming Reference.  The code 
compiles if I remove the parameters from the EnumWindowsProc function; 
however, then I don't know how to get a handle to the hWnd being 
enumerated.  What am I doing wrong?
Re: Using EnumWindows in C++Builder
#2401
Author: Remy Lebeau (TeamB)
Date: Wed, 28 Feb 2007 17:27
19 lines
1365 bytes
"Dan" <Dan@do.not.spam> wrote in message
news:45e5b922$1@newsgroups.borland.com...

> Hi, I am trying to use the EnumWindows function in a VCL
application,
> however, I am getting an error:
>
> "[C++ Error] Main.cpp(106): E2034 Cannot convert 'int (__stdcall
*)(void
> *,long)' to 'int (__stdcall *)()'"

You need to type-cast the function pointer that you are passing in,
ie:

    EnumWindows((WNDENUMPROC )EnumWindowsProc, NULL);


Gambit
Re: Using EnumWindows in C++Builder
#2404
Author: Dan
Date: Wed, 28 Feb 2007 18:47
3 lines
1013 bytes
> You need to type-cast the function pointer that you are passing in,
> ie:
How soon I forget the basics.. thanks
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads