들어오는 위도우 메시지를 모두 출력해보자
WindowsMessageMap.h
는 코드 참조
#include <Windows.h>
#include "WindowsMessageMap.h"
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static WindowsMessageMap mm;
OutputDebugString(mm(msg, lParam, wParam).c_str());
switch (msg)
{
case WM_CLOSE:
PostQuitMessage(69);
break;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}
메시지 처리해보기
#include <Windows.h>
#include "WindowsMessageMap.h"
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static WindowsMessageMap mm;
OutputDebugString(mm(msg, lParam, wParam).c_str());
switch (msg)
{
case WM_CLOSE:
PostQuitMessage(69);
break;
case WM_KEYDOWN:
if (wParam == 'F')
{
SetWindowText(hWnd, "Respects");
}
break;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}