Hello,
I have the following problem:
I need to get a list of all active windows. For that, I'm trying to use EnumWindows function and that means that I overwrite EnumWindowsProc.
This functions shoul look like this (taken from msdn.microsoft.com):
Code:BOOL EnumWindows(WNDENUMPROC lpEnumFunc, LPARAM lParam); Parameters: lpEnumFunc [in] Pointer to an application-defined callback function. For more information, see EnumWindowsProc. lParam [in] Specifies an application-defined value to be passed to the callback function.I wrote a small test .dll:Code:BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam); Parameters: hwnd [in] Handle to a top-level window. lParam [in] Specifies the application-defined value given in EnumWindows or EnumDesktopWindows.
But whenever i try to compile it, i get the following message:Code:#include <windows.h> #include <vcl.h> BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) { return TRUE; } int APIENTRY DllMain (HINSTANCE hInstance, DWORD ulReason, LPVOID lpReserved) { EnumWindows(EnumWindowsProc, NULL); return 1; }
[C++ Error] Unit1.cpp(60): E2342 Type mismatch in parameter 'lpEnumFunc' (wanted 'int (__stdcall *)()', got 'int (__stdcall *)(void *,long)')
If I remove parameters from EnumWindowsProc it will work, but then I dont know why would I need it to =)
I'd be really grateful for any idea why is that happening.
Thanks.




Reply With Quote