GetWindowTitle
-
also ich weiß nicht wie man getwindowtitle anwenden kann
ich möchte also hier ein bsp:FILE *windowfile windowfile = fopen("C:\\WinTitles.txt"); fclose(windowfile); while(1==1) { SleepEx(50,true); if(GetAsyncKeyState(0x41)) { CurrentWindowTitle = // ?????? (Getwindowtitle) aber wie ?! windowfile=fopen("c:\\WinTitles.txt","a+"); fputs(CurrentWindowTitle,windowfile); fclose(windowfile); } }nur wie kann man GetWindowTitle einsetzen ?
zb wenn ich nun A drücke speichert er den windowtitle des offenen fenster in eine text datei nur wie das nun
bitte um hilfe
danke schon im vorraus//Edit: codetag gefixt
-
C++ kennt keine Fenster.
Welches OS welcher Compiler ?
-
Windows Xp
Microsoft Visual C++ Studio 2003
-
Dieser Thread wurde von Moderator/in evilissimo aus dem Forum C++ 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.
-
Hallo,
Ich glaub du suchst GetWindowText
This function copies the text of the specified window’s title bar—if it has one—into a buffer. If the specified window is a control, the text of the control is copied. A remote application interface (RAPI) version of this function exists, and it is called CeGetWindowText.
int GetWindowText(
HWND hWnd,
LPTSTR lpString,
int nMaxCount );
ParametershWnd
Handle to the window or control containing the text.
lpString
Long pointer to the buffer that will receive the text.
nMaxCount
Specifies the maximum number of characters to copy to the buffer, including the NULL character. If the text exceeds this limit, it is truncated.
Return ValuesThe length, in characters, of the copied string, not including the terminating null character, indicates success. Zero indicates that the window has no title bar or text, if the title bar is empty, or if the window or control handle is invalid. To get extended error information, call GetLastError.
This function cannot retrieve the text of an edit control in another application.
-
danke für hilfe :
#include "stdafx.h" #include "windows.h" char title[512]; int _tmain(int argc, _TCHAR* argv[]) { FILE *windowfile ; windowfile = fopen("C:\\WinTitles.txt","w"); fclose(windowfile); while(1==1) { SleepEx(100,true); if(GetAsyncKeyState(0x41)) { windowfile=fopen("C:\\WinTitles.txt","a+"); HWND hwnd = GetForegroundWindow(); GetWindowText(hwnd, title, 512); fputs(title,windowfile); fputs("\n",windowfile); fclose(windowfile); } } return 0; }