How do I use Window's FindWindowA and SetForgroundWindow methods in UE5?

I am developing a physical installation for arch viz that uses a touch screen that sends its messages to the computer using OSC messages (TUIO Protocol). Because of that, in development I user an external TUIO touch table simulator. Basically a JAVA app where I can simulate multitouch actions, etc. The development process is such that I have to run my UE project in editor, and then manually tab to my simulator to put in inputs. It’s super annoying to have to remember to tab over on every run of the UE app.

I tried including WinUser.h, WindowsHWrapper, etc (and every combination of things to include that I found online) so that I can run this line of code:

	HWND hwnd = FindWindowA(NULL, "TUIO Simulator");
	if (hwnd)
	{
	     SetForegroundWindow(hwnd);
	}

Depending on which includes I tried, I get errors ranging from:

unresolved external symbol __imp_FindWindowA

to

C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winnt.h(169): fatal error C1189: #error: "No Target Architecture"

Any help on this much appreciated!

Unreal wants to own the system headers, because it does a fair bit of fancy integration with the system for reasons that are mostly good.

The cleanest work-around is to add an “external library plugin,” which makes an unreal plugin which can include external libraries. Then you write an external library that exposes the function you want into that plugin, and add the plugin to your project.

image