Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. EnumDisplayMonitors

EnumDisplayMonitors

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    daavena
    wrote on last edited by
    #1

    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.

    R 1 Reply Last reply
    0
    • D daavena

      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.

      R Offline
      R Offline
      Roger Stoltz
      wrote on last edited by
      #2

      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

      D 1 Reply Last reply
      0
      • R Roger Stoltz

        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

        D Offline
        D Offline
        daavena
        wrote on last edited by
        #3

        You are right. I forgot declare it as a static function. It's working. THANK YOU VERY MUCH.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups