0

I'm new to c++ and FindWindowA is working for some processes and not others, for example: FindWindowA(NULL, "Discord"); will work but FindWindowA(NULL, "Fortnite"); won't.

enter image description here

anyone know why? Thanks.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
  • 2
    If I wrote Fortnite I'd be doing everything I could to make the game as annoying as possible to hack. I wouldn't be the least bit surprised if that didn't include hiding it. – user4581301 Mar 11 '19 at 18:58
  • lmao, this is with anticheat bypassed and other programs like x64dbg and cheat engine can both see it –  Mar 11 '19 at 19:00
  • 1
    But are they using `FindWindowA` or some custom-cooked function? Are you sure the window is really named Fortnite? – user4581301 Mar 11 '19 at 19:03
  • Well when you hover over it it says Fortnite and in task manager it's called Fortnite, I also tried the Unreal Engine cooked name (FortniteGame) and the exe name (FortniteClient-Win64-Shipping) to no avail –  Mar 11 '19 at 19:05
  • Sounds like you've covered the low-hanging fruit. I'm going to shut up now and leave you to the experts and folks familiar with modern games and their evasion techniques. But one last bit of advice: If you're ever asked if by the computer if you want to play "Global Thermonuclear War" or a "Nice game of chess", pick the latter. – user4581301 Mar 11 '19 at 19:18
  • 1
    Why don't you use EnumWindows to find out what it is called – David Heffernan Mar 11 '19 at 19:34

2 Answers2

2

FindWindow only finds top level windows. If you are searching for an exact match with the title of the window, then you must take into account hidden characters (space, tab, etc.).

Even if you find the window title, it will only work if that window isn't localized—i.e., if the program that creates that window is localized for a different language, then you must also localize your search string.

A more reliable approach is to search for the class name, since this will typically not be localized: FindWindow("myclass", NULL);

Of course this will still fail if there is a hidden top level window that creates a child window containing the window you are looking for. To get that window, you can call EnumWindows to get the handle of each top level window, and for each top level window found, you then call EnumChildWindows.

Mehrad
  • 1,495
  • 14
  • 22
Randolph
  • 56
  • 5
1

Fortnite's window has a space or two

sd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
sd.OutputWindow = FindWindow((L"UnrealWindow"), (L"Fortnite  "));
sd.SampleDesc.Count = 1;
sd.Windowed = TRUE;