none
how to use Sendmessage in C#

    Question

  • Before, I had used SendMessage API in VB 6.0.
    Now, I want quick search a string in listbox by Sendmessage API and use C# language but I don't know how to do.
    Please, help me. Thanks

    PS: Sorry, my english is very poor.
    Saturday, December 01, 2007 3:36 PM

Answers

  • Hello,

     

    You need to import the function using:

                [DllImport("user32.dll")]
                public static extern int SendMessage(
                      int hWnd,      // handle to destination window
                      uint Msg,       // message
                      long wParam,  // first message parameter
                      long lParam   // second message parameter
                      );

     

    and define the message that you want to send like:

    public const int <WM_YOURMESSAGE> = <yourvalue>;

     

    and then call SendMessage like any other function.

    Saturday, December 01, 2007 6:02 PM

All replies

  • Hello,

     

    You need to import the function using:

                [DllImport("user32.dll")]
                public static extern int SendMessage(
                      int hWnd,      // handle to destination window
                      uint Msg,       // message
                      long wParam,  // first message parameter
                      long lParam   // second message parameter
                      );

     

    and define the message that you want to send like:

    public const int <WM_YOURMESSAGE> = <yourvalue>;

     

    and then call SendMessage like any other function.

    Saturday, December 01, 2007 6:02 PM
  • Thanks a lot
    Sunday, July 24, 2011 7:57 AM