in cpp/AdvancedColorImages/AdvancedColorImages/AdvancedColorImages.cpp [199:269]
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_FILE:
WCHAR szFileName[MAX_PATH];
if (LocateImageFile(hWnd, szFileName, ARRAYSIZE(szFileName)))
{
m_winComp->LoadImageFromFileName(szFileName);
}
else
{
MessageBox(hWnd, L"Failed to load image, select a new one.", L"Application Error", MB_ICONEXCLAMATION | MB_OK);
}
break;
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
break;
case WM_POINTERDOWN:
{
//Redirect input events to the InteractionTracker for input events.
PointerPoint pp = PointerPoint::GetCurrentPoint(GET_POINTERID_WPARAM(wParam));
m_winComp->TryRedirectForManipulation(pp);
break;
}
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
}
break;
case WM_SIZE:
{
//Update the child HWND to the new size of the parent HWnd.
RECT windowRect;
::GetWindowRect(hWnd, &windowRect);
::SetWindowPos(m_childHWnd, HWND_TOP, 0, 0, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_NOZORDER);
if (m_winComp != nullptr)
m_winComp->UpdateViewPort(true);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}