without the output window?

How can I omit the output window when
executing a program from vc++6.

In other words execute the program without the dos looking window.


Thank you
Info_user100Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
STARTUPINFO StartupInfo =
{
    sizeof(STARTUPINFO),
    NULL,
    NULL,
    NULL,
    0, 0,
    0, 0,
    0, 0,
    0,
    STARTF_USESHOWWINDOW,
    SW_HIDE,
    0,
    NULL,
    NULL,
    NULL,
    NULL
};

PROCESS_INFORMATION ProcessInformation;

if (::CreateProcess(NULL,
                    _T("the.exe"),
                    NULL,
                    NULL,
                    TRUE,
                    0,
                    NULL,
                    NULL,
                    &StartupInfo,
                    &ProcessInformation))

{
    ::CloseHandle(ProcessInformation.hProcess);
    ::CloseHandle(ProcessInformation.hThread);
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Info_user100Author Commented:
dO i HAVE TO ADD ANY EXTRA CODE TO MAKE THIS WORK.
0
Info_user100Author Commented:
I need to activate just one executable
which will start a process without
a window. When I embebd the code into
my utility I wasnt able to
_T("itself.exe"). This code works, but
if you can help me to make my exe run without a window on a start, it would be better.

Thanks.
0
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

chensuCommented:
Do you mean you want to hide your console window? Try FreeConsole.
0
Info_user100Author Commented:
Hello Chensu,

I tried FreeConsole, it detaches the process that is called but leaves a window for itself. Is there anything in
settings of the vc++ that disables the
window and continues with the process
in the background ?

0
chensuCommented:
There is no documented way to hide the console window. You can achieve it by creating a GUI application without any windows. Simply write the WinMain function.
0
nietodCommented:
>> You can achieve it by creating a GUI
>> application without any windows. Simply
>> write the WinMain function.
yes you need to change main() to WinMain() (along with its parameters), but there are also project settings that need to be changed.  It is probably easier to just create a new GUI application project (windows application project) and copy the code into that project, rather than try to conver the console application project.  (Unless chensu knows what need to be changed, but I don't.)

I use GUI apps for this purpose a lot.  If an error occurs and you want to display a message or some other event occurs where you suddenly want a console for one of these apps, you can create it with AllocConsole().  so this approach gives you the best of both worlds.
0
chensuCommented:
>It is probably easier to just create a new GUI application project (windows application project) and copy the code into that project, rather than try to conver the console application project.

That is what I meant.

To convert the console application project to a GUI application project, you need to change the link option to GUI subsystem and change some preprocessor macros. But as nietod said, creating a new GUI application project is much easier.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.