Write a VC++ Window program to display user defined push button and radio button on client area.As User Click the buttons appropriate message is displayed.

Add

#define IDC_MAIN_BUTTON 101
#define IDC_MAIN_RBUTTON 102



LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;

HWND button,but;

switch (message)
{
case WM_CREATE:
button=CreateWindowEx(0,"Button","RadioButton",WS_VISIBLE|WS_CHILD|BS_AUTORADIOBUTTON,250,220,100,24,hWnd,(HMENU)IDC_MAIN_RBUTTON,0,0);
but=CreateWindowEx(0,"Button","PushButton",WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,50,220,100,24,hWnd,(HMENU)IDC_MAIN_BUTTON,0,0);

break;

case WM_COMMAND:
hdc=GetDC(hWnd);
switch(LOWORD(wParam))
{
case IDC_MAIN_RBUTTON:
TextOut(hdc,50,50,"Radio Button Pressed.....",30);
break;
case IDC_MAIN_BUTTON:
TextOut(hdc,50,70,"Push Button is Pressed....",30);
break;
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}

Comments

Popular posts from this blog

Uploading Image to Sql Server Image Datatype in asp.net using fileupload Control

Get Running Sum of Query SQL Query