Is this "modern" message box user interface available in Qt? Or is it pure Windows API?

Modern versions of Windows (I would say 7+) have this nice interface that I see often:

enter image description here

It doesn't seem to have been built from scratch. It seems to me that it is already available in the Windows API.

Can this be loaded into Qt? What is the name of the widget? Or is it just MFC or something?

+3


source to share


2 answers


The three buttons are called Commands or Command Link Control . It was first introduced as part of the Windows XP API. I think the form in the picture (with explanation of the command line text) is available with Windows Vista.

If you want to port your code, you cannot use it in Qt. Even Wine cannot display command buttons yet. (In Wine 2.0 they are invisible, but clickable).



Update: Qt has a QCommandLinkButton class .

+3


source


This is called the TaskDialog , which has been available since Windows Vista. This is a pure Win API.

I don't know if there is a Qt wrapper available ( Edit : @thomiels's answer to Qt widget).



Here is some native code to create a dialog similar to the one shown in the screenshot:

#include <Windows.h>
#include <CommCtrl.h>
#pragma comment(lib,"comctl32.lib")
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

int main(int argc, char* argv[])
{   
    TASKDIALOGCONFIG cfg{ sizeof(cfg) };
    const TASKDIALOG_BUTTON buttons[] = {
        { IDOK, L"Do something" },
        { IDCANCEL, L"Do another something" },
    };
    cfg.hInstance                    = ::GetModuleHandle( nullptr );
    cfg.dwCommonButtons              = 0;
    cfg.pszMainIcon                  = TD_INFORMATION_ICON;
    cfg.pszMainInstruction           = L"Here you can do awesome stuff";
    cfg.pszContent                   = L"What do you want to do?";
    cfg.pButtons                     = buttons;
    cfg.cButtons                     = ARRAYSIZE(buttons);
    cfg.dwFlags                      = TDF_USE_COMMAND_LINKS;

    HRESULT hr = TaskDialogIndirect( &cfg, nullptr, nullptr, nullptr );
}

      

+3


source







All Articles