Hi there guys, im trying to simulate a key press with TranslateMessage but I dont know what parameters to pass to the object.
This is what I 've got so far:
Im trying to send ENTER key or whatever..
Thanks im advance!
This is what I 've got so far:
C#:
[DllImport("user32.dll")]
static extern bool TranslateMessage([In] ref MSG lpMsg);
const int WM_KEYDOWN = 0x0100;
const int WM_KEYUP = 0x0101;
public struct MSG
{
public IntPtr hwnd;
public uint message;
public IntPtr wParam;
public IntPtr lParam;
public uint time;
public POINT pt;
}
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public int X;
public int Y;
public POINT(int x, int y)
{
this.X = x;
this.Y = y;
}
}
static void Main(string[] args)
{
Thread.Sleep(3000);
MSG m = new MSG();
m.message = 0x0D;
//m.lParam = (IntPtr)WM_KEYDOWN;
m.wParam = (IntPtr)WM_KEYDOWN;
m.pt = new POINT();
m.time = 0;
bool p = TranslateMessage(ref m);
}
Im trying to send ENTER key or whatever..
Thanks im advance!