2

I'm running an exe through which I get a handle of a control in another exe. Now what I want to do is send messages to the particular handle from my exe.

MSalters
  • 173,980
  • 10
  • 155
  • 350
RV.
  • 2,782
  • 8
  • 39
  • 51

1 Answers1

7

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.

Vinay
  • 4,743
  • 7
  • 33
  • 43