Write a VC++ Program to Display String with Diffrent Width on Each Mouse Click.The String Should be Displayed at the Point where User Click.

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

HFONT hf;
int x1,y1;

switch (message)
{
case WM_LBUTTONDOWN:
hdc=GetDC(hWnd);
x1=LOWORD(lParam);
y1=HIWORD(lParam);
hf=CreateFont(rand()%50,0,0,0,0,700,0,0,0,0,0,0,0,"Times New Roman");
SelectObject(hdc,hf);
SetTextColor(hdc,RGB(rand()%255,rand()%255,rand()%255));
TextOut(hdc,x1,y1,"GHRIBM",6);
return 0;
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