Thread: Help

  1. #1
    JOANNA
    Guest

    Unhappy 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.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    >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.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    JOANNA
    Guest
    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.

  4. #4
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    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.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed