i want help in my code

i was going to develop the code for the following requirements
Task 1:
a - Write a Program for windows with client area
b – Windows has caption as “Mouse Tester”
c – Windows has Minimize, Maximize and Close Buttons at the top right corner
d – Windows length and width would be as DEFAULT

Task 2:
a – When a Left Mouse Button is pressed in Client Area; a message box would be appearing with text as “Left Mouse Button is Pressed.”
b – When a Right Mouse Button is pressed in Client Area; a message box would be appearing with text as “Right Mouse Button is Pressed.”
c – In sub tasks a and b, the message box appeared would have following properties;
I – Caption of Message Boxes are “Mouse Press Information”
II – Message Boxes have Information Icon
here i have the code what extra thing shuld be added in it to complete the requirements plzzzzz help me
here is the code
#include <windows.h>

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
static char sClassName[] = "MyClass";

static HINSTANCE zhInstance = NULL;



int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {

WNDCLASSEX WndClass;

HWND hwnd;

MSG Msg;



zhInstance = hInstance;



WndClass.cbSize = sizeof(WNDCLASSEX);

WndClass.style = NULL;

WndClass.lpfnWndProc = WndProc;

WndClass.cbClsExtra = 0;

WndClass.cbWndExtra = 0;

WndClass.hInstance = zhInstance;

WndClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);

WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);

WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);

WndClass.lpszMenuName = NULL;

WndClass.lpszClassName = sClassName;

WndClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);



if(!RegisterClassEx(&WndClass)) {

MessageBox(0, "Error Registering Class!", "Error!", MB_ICONSTOP | MB_OK);

return 0;

}



hwnd = CreateWindowEx(WS_EX_STATICEDGE, sClassName, "mouse lisner", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,



CW_USEDEFAULT,

320, 240, NULL, NULL, zhInstance, NULL);



if(hwnd == NULL) {

MessageBox(0, "Error Creating Window!", "Error!", MB_ICONSTOP | MB_OK);

return 0;

}



ShowWindow(hwnd, nCmdShow);

UpdateWindow(hwnd);



while(GetMessage(&Msg, NULL, 0, 0)) {

TranslateMessage(&Msg);

DispatchMessage(&Msg);

}



return Msg.wParam;

}



LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {

switch(Message) {

case WM_CLOSE:

DestroyWindow(hwnd);

break;

case WM_DESTROY:

PostQuitMessage(0);

break;

default:

return DefWindowProc(hwnd, Message, wParam, lParam);

}

return 0;

}
Have you tried looking in to the Windows API at all. I am certain there is a message for mouse clicks that would get you what you want
Topic archived. No new replies allowed.