Hello everyone,
I'm trying to use the EnumWindowStations function from the WinUser.h library but I can't pass it the pointer to the callback function I created. That is, it is not clear to me how it should do it and I cannot clarify my ideas on this problem despite the fact that I have studied the references to this function.
(
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumwindowstationsw )
My code:
BOOL CALLBACK CWinLogon::EnumWindowStationProc(__in LPWSTR lpszWindowStation,__in LPARAM lParam)
{
...
return true;
}
void MyFunction()
{
if ( EnumWindowStations(&EnumWindowStationProc, NULL) )
home_window_station = 0;
}
I receive this error:
the argument of type "BOOL (__stdcall *) (LPWSTR lpszWindowStation, LPARAM lParam)" is incompatible with the type parameter "WINSTAENUMPROCW"
now going to see the definitions on the WinUser.h file
code:
typedef BOOL (CALLBACK* NAMEENUMPROCW)(LPWSTR, LPARAM);
typedef NAMEENUMPROCW WINSTAENUMPROCW;
typedef WINSTAENUMPROCW WINSTAENUMPROC;
At this point I'm stuck, I can't figure out how to pass the EnumWindowStationProc function to EnumWindowStations.
Can anyone clarify my ideas?
Thanks so much