How to create a windows application in C++ showing just a TaskDialog

2.4k views Asked by At

I need to create a windows application in C++ and it has to show just a TaskDialog (see http://msdn.microsoft.com/en-us/library/windows/desktop/bb760540(v=vs.85).aspx ). The TaskDialog should show a text passed as parameter to the command line.

I can make a "Win32 Console Application" and call TaskDialog but then I will see the black windows of the console.

I can make a "Windows Application" and just calling TaskDialog inside WinMain, is there any problem with this solution?

Any other idea?

2

There are 2 answers

3
David Heffernan On BEST ANSWER

I can make a "Windows Application" and just calling TaskDialog inside WinMain, is there any problem with this solution?

That is the way to implement such an app. There is no problem with it all. Of course you don't create a window explicitly in your code and you don't run a message loop. Just call TaskDialog.

The main point is that you don't want a console app because, as you have discovered, a console window is shown by default. There are two main subsystems, the console subsystem and the GUI subsystem. The latter is somewhat confusingly named. You are not compelled to show GUI in a GUI subsystem app. It's up to you whether or not you choose to do so. Really the choice comes down to whether or not you want a console. So the subsystems could be better named as console and non-console!

1
Norbert Willhelm On

You have to create a empty windows application.

The entry point of a windows application is calles WinMain and looks like this:

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
    //Place your code here
}

This means your solution is correct. You just have to make sure that your application uses version 6 of Comctl32.dll. Otherwise TaskDialog will fail.