Reputation: 637
I am using Embarcadero C++ 10.2 ‘Tokyo’ command line Compiler as a small footprint compiler, it is distributed in a compressed form and easily 'portable'.
I am trying to implement this small Close Tray
program using Win32 API.
#include <windows.h>
int main()
{
mciSendString("Set CDAudio Door Closed Wait", 0, 0, 0);
return 0;
}
Compiling it using bcc32c Close.cpp
works fine but the console window appears as it should when the executable is double clicked.
Is there a way to cancel its presence like the /SUBSYSTEM:WINDOWS
that is used with Microsoft compiler.
Update: For instance in order to do that in Digital Mars
, I compile the source file using sc source.c
then use its linker Optlink
like that
link source.obj,,,winmm.lib /subsystem:windows
because compiling it isn't enough in Digital Mars, it needs linking to winmm.lib
while Embarcadero's compiler does that automatically.
Update 2: I also saw an option -tW
to make the taget executable for Windows but it didn't work so is using bcc32x -mwindows
since it is based on Clang and still didn't get the result needed.
Upvotes: 1
Views: 830
Reputation: 126
You might try
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int CmdShow) {
mciSendString("Set CDAudio Door Closed Wait", 0, 0, 0);
return 0;
}
On command line compiler it compiles with
bcc32 -W winmain.c
I don't know if the switch works on your compiler.
Update: The WinMain parameters can be omitted if not needed.
int WINAPI WinMain() {
Upvotes: 5