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. WndProc Within a class

WndProc Within a class

Scheduled Pinned Locked Moved C / C++ / MFC
help
3 Posts 3 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.
  • M Offline
    M Offline
    M Mostafa
    wrote on last edited by
    #1

    Hi Guys , I'm building a class that will help me reduce the code I need to write to get an OGL window up and running , But I've some issue , when I start filling up the Window Class structure , I come to the WNDPROC ,I want to pass the address of a method in the main class , but I get an (error C2440: '=' : cannot convert from 'long (__stdcall OGLWindow::*)(struct HWND__ *,unsigned int,unsigned int,long)' to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)) ,I wonder if there's some way I can estblish this kind of converstion , or else I'll just have to write the WndProc function seperate from the class , I hope I'm making sense here , thanks in advance for any help

    S J 2 Replies Last reply
    0
    • M M Mostafa

      Hi Guys , I'm building a class that will help me reduce the code I need to write to get an OGL window up and running , But I've some issue , when I start filling up the Window Class structure , I come to the WNDPROC ,I want to pass the address of a method in the main class , but I get an (error C2440: '=' : cannot convert from 'long (__stdcall OGLWindow::*)(struct HWND__ *,unsigned int,unsigned int,long)' to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)) ,I wonder if there's some way I can estblish this kind of converstion , or else I'll just have to write the WndProc function seperate from the class , I hope I'm making sense here , thanks in advance for any help

      S Offline
      S Offline
      S O S
      wrote on last edited by
      #2

      You can't put it in a class. All non-static class functions have a hidden "this" argument, so the function signature won't match with the WNDPROC one.

      1 Reply Last reply
      0
      • M M Mostafa

        Hi Guys , I'm building a class that will help me reduce the code I need to write to get an OGL window up and running , But I've some issue , when I start filling up the Window Class structure , I come to the WNDPROC ,I want to pass the address of a method in the main class , but I get an (error C2440: '=' : cannot convert from 'long (__stdcall OGLWindow::*)(struct HWND__ *,unsigned int,unsigned int,long)' to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)) ,I wonder if there's some way I can estblish this kind of converstion , or else I'll just have to write the WndProc function seperate from the class , I hope I'm making sense here , thanks in advance for any help

        J Offline
        J Offline
        John R Shaw
        wrote on last edited by
        #3

        See the article: Use member functions for C-style callbacks and threads - a general solution INTP

        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