Eine Taste in C++ an Windows XP Senden
-
Ich glaube es reicht noch nicht das ich bis jetzt nur ein halbes Jahr Programmieren hatte
Ich verstehe fast nix
Hat einer Zeit/Lust mir das so zu erklären das ich das hinbekomme?
mfg
-
Geht das irgendwie so?
Code:
#include <windows.h>
void main ()
{
::PostMessage(::FindWindow(VK_HELP(31), test123.txt - Editor), WM_..., 0, 0);
}
-
Was soll der erste Parameter bei FindWindow für nen Sinn bei dir haben?
MSDN schrieb:
FindWindow Function
The FindWindow function retrieves a handle to the top-level window whose class name and window name match the specified strings. This function does not search child windows. This function does not perform a case-sensitive search.
To search child windows, beginning with a specified child window, use the FindWindowEx function.
Syntax
HWND FindWindow(
LPCTSTR lpClassName,
LPCTSTR lpWindowName
);Parameters
lpClassName
[in] Pointer to a null-terminated string that specifies the class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero.If lpClassName points to a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
If lpClassName is NULL, it finds any window whose title matches the lpWindowName parameter.
lpWindowName
[in] Pointer to a null-terminated string that specifies the window name (the window's title). If this parameter is NULL, all window names match.
-
Dieser Thread wurde von Moderator/in Marc++us aus dem Forum Rund um die Programmierung in das Forum WinAPI verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
Ich hatte das so verstanden das "VK_HELP(31)" bedeutet das das Zeichen "1" gesendet wird.
-
Ich habe eben rausgefunden wie die Bezeichnug meines Testfensters sein müsste:
Tietel:
test123.txt - Editor
class:
Notepadoder
Tietel:
Program Manager
class:
Progman
-
wenn du das an FindWindow übergibts wird es nicht ans andere Fenster gesendet.
-
Wie mach ich es dann das eine Taste an mein Fenster gesendet wird?
-
Geht das mit dieser Funktion ??
keybd_event(VK_HELP(31)???????????;
-
Heute solltest Du SendInput verwenden:
INPUT pInput[2]; pInput[0].type = INPUT_KEYBOARD; pInput[0].ki.wVk = '1'; pInput[0].ki.wScan = 0; pInput[0].ki.dwFlags = 0; // Nill for keydown pInput[0].ki.time = 0; pInput[0].ki.dwExtraInfo = 0; pInput[1].type = INPUT_KEYBOARD; pInput[1].ki.wVk = '1'; pInput[1].ki.wScan = 0; pInput[1].ki.dwFlags = KEYEVENTF_KEYUP; pInput[1].ki.time = 0; pInput[1].ki.dwExtraInfo = 0; if (SendInput(2, pInput, sizeof(INPUT)) == 0) { return false; }
-
THX erstma
aba..
Ich glaub ich frag meinen prog Lehrer morgen ma aus ob der mir sagen kann wie ich diese Funktionen richtig benutze^^