Write a VC++ Program to display line by pressing ctrl+F1 and Circle by Alter+F2.
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_SYSKEYDOWN:
hdc=GetDC(hWnd);
if(GetKeyState(VK_MENU)<0 && GetKeyState(VK_F2)<0)
{
Ellipse(hdc,50,50,200,200);
}
break;
case WM_KEYDOWN:
hdc=GetDC(hWnd);
if(GetKeyState(VK_CONTROL)<0 && GetKeyState(VK_F1)<0)
{
MoveToEx(hdc,100,100,0);
LineTo(hdc,400,400);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
Comments
Post a Comment