Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
HWND hwnd = FindWindow("firefox.exe",NULL);
RECT *rect = (RECT*)malloc(sizeof(RECT));
system("cls");
GetWindowRect(hwnd,rect);
cout<<"X: "<<rect->left<<endl
<<"Y: "<<rect->top<<endl
<<"X + Fensterbreite: "<<rect->right<<endl
<<"Y + Fensterhoehe: "<<rect->bottom;
X: 25263848
Y: 25246744
X + Fensterbreite: 1935438711
Y + Fensterhoehe: 1702130553
Bei GetLastError() kommt als ausgabe "1400"![]()
HWND w=FindWindowEx(NULL, NULL, NULL, NULL);
char TName[512];
while(w)
{
GetWindowText(w, TName, 512);
if(strstr(TName, "Firefox"))
{
GetClassName(w,TName, 512);
cout << TName << endl;
}
w=GetNextWindow(w, GW_HWNDNEXT);
}
const ::HWND GetCursorPosWindow()
{
::POINT mouse_position = {};
if (!::GetCursorPos(&mouse_position)) throw std::runtime_error("unknown error");
return ::WindowFromPoint(mouse_position);
}
int main()
{
const ::HWND window(GetCursorPosWindow());
if (window == NULL) return std::cerr << "FEHLER: Es liegt kein Fenster an dieser Stelle!" << std::endl, 1;
::RECT rect = {};
::GetWindowRect(window, &rect);
std::cout << "x: " << rect.left << " y: " << rect.top << " width: " << rect.right - rect.left << " height: " << rect.bottom - rect.top << std::endl;
}