EnumDisplayMonitors
-
Hi, I need to use EnumDisplayMonitors at my class. BOOL EnumDisplayMonitors( HDC hdc, // handle to display DC LPCRECT lprcClip, // clipping rectangle MONITORENUMPROC lpfnEnum, // callback function LPARAM dwData // data for callback function ); there is MONITORENUMPROC - pointer to a function BOOL CALLBACK MonitorEnumProc( HMONITOR hMonitor, // handle to display monitor HDC hdcMonitor, // handle to monitor DC LPRECT lprcMonitor, // monitor intersection rectangle LPARAM dwData // data ); here is my code. MONITORENUMPROC pEnumMon;//pointer to my function //my function BOOL CALLBACK MyPaintEnumProc(HMONITOR hMonitor,HDC hdc,LPRECT lprcMonitor, LPARAM data){ return true; } and now this->pEnumMon = &MyClassName::MyPaintEnumProc But it doesn't work. Error 1 error C2440: '=' : cannot convert from 'BOOL (__stdcall MyClassName::* )(HMONITOR,HDC,LPRECT,LPARAM)' to 'MONITORENUMPROC' What am I doing wrong? Thank you very much.
-
Hi, I need to use EnumDisplayMonitors at my class. BOOL EnumDisplayMonitors( HDC hdc, // handle to display DC LPCRECT lprcClip, // clipping rectangle MONITORENUMPROC lpfnEnum, // callback function LPARAM dwData // data for callback function ); there is MONITORENUMPROC - pointer to a function BOOL CALLBACK MonitorEnumProc( HMONITOR hMonitor, // handle to display monitor HDC hdcMonitor, // handle to monitor DC LPRECT lprcMonitor, // monitor intersection rectangle LPARAM dwData // data ); here is my code. MONITORENUMPROC pEnumMon;//pointer to my function //my function BOOL CALLBACK MyPaintEnumProc(HMONITOR hMonitor,HDC hdc,LPRECT lprcMonitor, LPARAM data){ return true; } and now this->pEnumMon = &MyClassName::MyPaintEnumProc But it doesn't work. Error 1 error C2440: '=' : cannot convert from 'BOOL (__stdcall MyClassName::* )(HMONITOR,HDC,LPRECT,LPARAM)' to 'MONITORENUMPROC' What am I doing wrong? Thank you very much.
daavena wrote:
Error 1 error C2440: '=' : cannot convert from 'BOOL (__stdcall MyClassName::* )(HMONITOR,HDC,LPRECT,LPARAM)' to 'MONITORENUMPROC' What am I doing wrong?
Have you declared the member function as
static
, as I suggested here[^]?"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
daavena wrote:
Error 1 error C2440: '=' : cannot convert from 'BOOL (__stdcall MyClassName::* )(HMONITOR,HDC,LPRECT,LPARAM)' to 'MONITORENUMPROC' What am I doing wrong?
Have you declared the member function as
static
, as I suggested here[^]?"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown