Déclaration d'une calback dans une classe ?
	
	
		Bonjours,
Je voudrai savoir comment on déclare la fonction. l'exemple ici est celui fourni par défaut de code block 
*.hpp
	Code:
	
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 
 |  
#ifndef DEF_ME_WIN
#define DEF_ME_WIN
 
#include <tchar.h>
#include <windows.h>
 
#include <iostream>
class C_MeDefaultWindows
{
	public:
		C_MeDefaultWindows ();
 
		void WinDefault(HINSTANCE & hThisInstance);
    //private:
        LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
};
#endif | 
 
	Code:
	
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 
 |  
#include "cdefaultwindows.hpp"
C_MeDefaultWindows::C_MeDefaultWindows(){}
 
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)                  /* handle the messages */
    {
        case WM_DESTROY:
            PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
            break;
        default:                      /* for messages that we don't deal with */
            return DefWindowProc (hwnd, message, wParam, lParam);
    }
 
    return 0;
}
 
void C_MeDefaultWindows::WinDefault(HINSTANCE & hThisInstance){
  HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */
    TCHAR szClassName[ ] = _T("CodeBlocksWindowsApp");
 
    /* The Window structure */
 
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = C_MeDefaultWindows::WindowProcedure;      /* comment déclarer ?? */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);
 
    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default colour as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
}; | 
 
	Code:
	
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 
 |  
#if defined(UNICODE) && !defined(_UNICODE)
    #define _UNICODE
#elif defined(_UNICODE) && !defined(UNICODE)
    #define UNICODE
#endif
 
#include <tchar.h>
#include <windows.h>
 
#include "cdefaultwindows.hpp"
#include <iostream>
/*  Declare Windows procedure  */
//LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
 
/*  Make the class name into a global variable  */
//TCHAR szClassName[ ] = _T("CodeBlocksWindowsApp");
 
int WINAPI WinMain (HINSTANCE hThisInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR lpszArgument,
                     int nCmdShow)
{
    C_MeDefaultWindows CMDW;
    CMDW.WinDefault(hThisInstance);
    return 0;
} | 
 
	Code:
	
| 12
 3
 
 |  
28:23: error: cannot convert 'C_MeDefaultWindows::WindowProcedure' from type 'LRESULT (C_MeDefaultWindows::)(HWND, UINT, WPARAM, LPARAM) {aka long int (C_MeDefaultWindows::)(HWND__*, unsigned int, unsigned int, long int)}' to type 'WNDPROC {aka long int (__attribute__((__stdcall__)) *)(HWND__*, unsigned int, unsigned int, long int)}'
     wincl.lpfnWndProc = C_MeDefaultWindows::WindowProcedure;      /* This function is called by windows */ | 
 La ligne concernée c'est donc WindowProcedure. 
Merci d'avance