How to disable close button in application window

I’m new to haxe, and I’m wondering if its possible to disable the close button in windows API like this:
I want to add it to my game to make it seem like you are being hacked even though you are not, but I’m not sure how to do it. I’m also not sure if this is the right place to ask this, but it’s not too related to haxeflixel. If you can move the application window and resize it. I’m wondering if this is possible. Can someone help me please?

Not super familiar with HaxeFlixel/OpenFL, but if this feature is not supported directly, you could probably achieve it on a C++ target using untyped __cpp__.

Doing a quick search, if you can obtain the lime.ui.Window, you should be able to get the handle doing:

#if cpp
// __backend returns NativeWindow
final handle = @:privateAccess win.__backend.handle;

untyped __cpp__("EnableMenuItem(GetSystemMenu({0}, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED)", handle);

You would also need to make sure the “Windows.h” and any other headers are included (using @:headerInclude on the class the code is in?)

Haven’t tested any of this myself, but that could be a start?

Does that disable the close button?