-
Help
hi,Guys,
i am in window programming.i really need urs guys help.
i have a doubt in this question. Create a program that will display welcome everytime the user clicks on the right mouse button.
i have this several times but it still doesn't worked.
Clear my doubt !! Thanks.
-
>Create a program that will display welcome everytime
>the user clicks on the right mouse button.
In a window ? In Windows in general ? Where should
the Welcome be displayed ? What have you tried yet ?
What do you use, simple Win32Api or MFC ?
Look up the windows message WM_RBUTTONDOWN for
starters.
-
hi,guys.
i think i have u so confious.so sorry about that.
actually,it's a very simple program.it's using the WIN32API to write this program.i am just a beginner.pls help me out.
thanks.i will wait for urs reply.
-
Without showing what you have, it's hard to explain without
posting 200+ lines of code. You should have a basic application
set up. It should display a window. If you are lacking this,
look for Sunlights tutorial on www.cprogramming.com.
Somewhere in your program, there should be a messageloop.
Code:
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch( message )
{
case WM_COMMAND:
...
default:
return DefWindowProc( hWnd, message, wParam, lParam );
}
}
In there you have to add another case label
for WM_RBUTTONDOWN like this:
case WM_RBUTTONDOWN:
// do your displaying here
break;
that should lead to your displaying being done whenever
someone presses the right mousebutton in your window.