SOL9 Sample: TaskDialog

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * TaskDialog.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL9
// 2009/04/01

//Vista
#define WIN32_WINNT 0x0600

#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include <tchar.h>

//Vista specific sample

/* TaskDialog.exe.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
<description>SOL9 TaskDialog Sample</description>
<dependency> 
  <dependentAssembly> 
    <assemblyIdentity
      type="win32" 
      name="microsoft.windows.common-controls" 
      version="6.0.0.0" 
      processorArchitecture="x86" 
      publicKeyToken="6595b64144ccf1df" 
      language="*" 
    /> 
  </dependentAssembly> 
</dependency> 
</assembly> 
*/

//compile.bat
//
//1 Compile a source file and link with comctl32.lib for 'TaskDialog' API.
//cl TaskDialog.cpp comctl32.lib
//
//2 Embed a manifest file into an application by mt.exe
//mt.exe -manifest TaskDialog.exe.manifest -outputresource:TaskDialog.exe;1

/*
ICON_ID:
  TD_WARNING_ICON
  TD_ERROR_ICON
  TD_INFORMATION_ICON
  TD_SHIELD_ICON 
*/

void _tmain(int argc, TCHAR** argv)
{
  int rc = 0;
  const wchar_t* title = L"SOL9";

  HWND hParent = NULL;
  HINSTANCE hInstance = NULL;

  TaskDialog(hParent, 
    hInstance,
    title,
    L"SOL9 Task Dialog TDCBF_OK_BUTTON and TD_INFORMATION_ICON",
    L"This is a sample for 'TaskDialog' which is a Windows Vista specific API",
    TDCBF_OK_BUTTON,
    TD_INFORMATION_ICON,
    &rc);

  printf("TaskDialog: Hitted Button =%d\n", rc);  

  TaskDialog(hParent, 
    hInstance,
    title,
    L"SOL9 Task Dialog TDCBF_OK_BUTTON|DCBF_CANCEL_BUTTON and TD_WARNING_ICON",
    L"This is a sample for 'TaskDialog' which is a Windows Vista specific API",
    TDCBF_OK_BUTTON|TDCBF_CANCEL_BUTTON,
    TD_WARNING_ICON,
    &rc);

  printf("TaskDialog: Hitted Button =%d\n", rc);  

  TaskDialog(hParent, 
    hInstance,
    title,
    L"SOL9 Task Dialog TDCBF_YES_BUTTON|TDBC_NO_BUTTON and TD_SHIELD_ICON",
    L"This is a sample for 'TaskDialog' which is a Windows Vista specific API",
    TDCBF_YES_BUTTON|TDCBF_NO_BUTTON,
    TD_SHIELD_ICON,
    &rc);

  printf("TaskDialog: Hitted Button =%d\n", rc);  


  TaskDialog(hParent, 
    hInstance,
    title,
    L"SOL9 Task Dialog TDCBF_OK_BUTTON and TD_ERROR_ICON",
    L"This is a sample for 'TaskDialog' which is a Windows Vista specific API",
    TDCBF_OK_BUTTON,
    TD_ERROR_ICON,
    &rc);

  printf("TaskDialog: Hitted Button =%d\n", rc);  


}


Last modified: 2 May 2016

Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.