void Base::RegisterWnd(HINSTANCE hInstance)
{
ZeroMemory(&WndCls, sizeof(WNDCLASSEX));
WndCls.cbSize = sizeof(WNDCLASSEX);
WndCls.hbrBackground = (HBRUSH)COLOR_WINDOW;
WndCls.hCursor = LoadCursor(NULL, IDC_ARROW);
WndCls.hIcon = LoadIcon(hInstance, NULL);
WndCls.hIconSm = LoadIcon(hInstance, NULL);
WndCls.hInstance = hInstance;
WndCls.lpfnWndProc = CallWindowProc; << What should i put here
}
I am trying to register the window class by using object oriented method. I have no idea what should I put for the lpfnWndProc in the class cpp. For the header file, this is how it looks like
#pragma once
#ifndef BASE_H
#define BASE_H
#include <Windows.h>
#include <windowsx.h>
class Base
{
HWND hWnd;
WNDCLASSEX WndCls;
public:
Base();
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
void RegisterWnd(HINSTANCE hInstance);
void CreateWnd();
void ShowWnd();
~Base();
};
#endif
Please correct me if I am doing anything wrong. Still learning. Sorry and thanks :)
HWND hWndparameter. So, you need some global map, which keeps (HWND, Base*) pairs. Using this map, you can callBaseinstance member from global lpfnWndProc.