problem w SendMessage fn - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

problem w SendMessage fn

arvind17arvind17 Posts: 62Member
hi,
I having problem with this piece of code

SendMessage(WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(fig.x, fig.y) );

There is nothing wrong with the above code.
In View.cpp is OK. No compile errors.

I have a file Draw_Consumer.cpp. I put the above in it. This is where the codes should be according to my a pplication.
I respectively have the error that SendMessage cannot take 3 parameters. I remove one, then it cannot take 2 parameters. I remove another one then it cannot take 1 param. Then similarly it cannot take 1 param when I remove the last one.

Well what should I do to get the above working ?
I guess that in the Draw_Consumer.cpp file the SendMessage is not getting the instance of CWnd which is created when the application has been created. Thought I cannot see what I should be doing.

Anyway let me know what I should be doing.

regards
-arvind

Comments

  • AldebaranAldebaran Posts: 23Member
    : hi,
    : I having problem with this piece of code
    :
    : SendMessage(WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(fig.x, fig.y) );
    :
    : There is nothing wrong with the above code.
    : In View.cpp is OK. No compile errors.
    :
    : I have a file Draw_Consumer.cpp. I put the above in it. This is where the codes should be according to my a pplication.
    : I respectively have the error that SendMessage cannot take 3 parameters. I remove one, then it cannot take 2 parameters. I remove another one then it cannot take 1 param. Then similarly it cannot take 1 param when I remove the last one.
    :
    : Well what should I do to get the above working ?
    : I guess that in the Draw_Consumer.cpp file the SendMessage is not getting the instance of CWnd which is created when the application has been created. Thought I cannot see what I should be doing.
    :
    : Anyway let me know what I should be doing.
    :
    : regards
    : -arvind


    Since you're using the CWnd::SendMessage method, you need to put an CWnd instance in front of your call, like [b].[/b]SendMessage(...).
    Otherwise your call is taken as the API function, SendMessage() which requires 4 arguments - the first argument is the window handle, followed by the arguments you already have.

  • arvind17arvind17 Posts: 62Member
    thanks that helped me.
    I made Draw_Consumer use CWind As base class


    : : hi,
    : : I having problem with this piece of code
    : :
    : : SendMessage(WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(fig.x, fig.y) );
    : :
    : : There is nothing wrong with the above code.
    : : In View.cpp is OK. No compile errors.
    : :
    : : I have a file Draw_Consumer.cpp. I put the above in it. This is where the codes should be according to my a pplication.
    : : I respectively have the error that SendMessage cannot take 3 parameters. I remove one, then it cannot take 2 parameters. I remove another one then it cannot take 1 param. Then similarly it cannot take 1 param when I remove the last one.
    : :
    : : Well what should I do to get the above working ?
    : : I guess that in the Draw_Consumer.cpp file the SendMessage is not getting the instance of CWnd which is created when the application has been created. Thought I cannot see what I should be doing.
    : :
    : : Anyway let me know what I should be doing.
    : :
    : : regards
    : : -arvind
    :
    :
    : Since you're using the CWnd::SendMessage method, you need to put an CWnd instance in front of your call, like [b].[/b]SendMessage(...).
    : Otherwise your call is taken as the API function, SendMessage() which requires 4 arguments - the first argument is the window handle, followed by the arguments you already have.
    :
    :

Sign In or Register to comment.