How is WinMain()
actually called? I remember a function used by pro-hackers that started with (something) that looked like __startupWinMain()
.
The problem is, I have a Win32 EXE(compiled with /SUBSYSTEM:WINDOWS
) but gets arguments from command-line. If the command line is incorrect, the process should print a help message to the console.
How can I manually deallocate(or FreeConsole()
) from an exe with /SUBSYSTEM:WINDOWS
linker option?
As the very first act of your program, check the parameters. If they are fine, continue as normal.
Otherwise call AttachConsole
passing ATTACH_PARENT_PROCESS
. If that succeeds, then you can print your error to stdout and quit. If it doesn't, then you'll have to show the error in a message box.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With