Witam, bawię się z tym już jakiś czas i nie mogę znaleźć rozwiązania do następującego problemu: chce wysłać do okna kombinacje klawiszy ALT + 1 np, niestety każde rozwiązanie, które znalazłem, jest nieskuteczne. Prosiłbym o podpowiedzenie mi czegoś(nie, nie odsyłanie mnie do dokumentacji lub pisanie RTFM, ponieważ to już zrobiłem).
[DllImport("User32.Dll", EntryPoint = "PostMessageA", SetLastError = true)]
static extern bool PostMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(String ClassName, String WindowName);
const int WM_SYSKEYDOWN = 0x0104;
const int WM_SYSKEYUP = 0x0105;
const int VK_1 = 0x31;
const int VK_ALT = 0x12;
const int WM_CHAR = 0x0102;
IntPtr hWnd = FindWindow(null, "Kalkulator");
public void SendAlt1()
{
PostMessage(hWnd, WM_SYSKEYDOWN, VK_1, VK_ALT);
PostMessage(hWnd, WM_SYSKEYUP, VK_V1 VK_ALT);
}