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:
image
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
// https://github.com/openfl/lime/blob/e6205bf3aaace23c7e2458841da4435ff9879eaf/src/lime/_internal/backend/native/NativeWindow.hx#L39
final handle = @:privateAccess win.__backend.handle;

// https://devblogs.microsoft.com/oldnewthing/20100604-00/?p=13803
untyped __cpp__("EnableMenuItem(GetSystemMenu({0}, FALSE), SC_CLOSE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED)", handle);
#end

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?