If you haven't used TaskDialog it is in "commctrl.bi".
Here is a snippet - TaskDialog.bas
Code: Select all
#define UNICODE
#define _WIN32_WINNT &h0602
#include once "windows.bi"
#include once "win\commctrl.bi"
Dim pnButton as Long
TaskDialog( Null, Null, "MyApp", "Posh main message", "Secondary message", TDCBF_OK_BUTTON or TDCBF_YES_BUTTON or TDCBF_NO_BUTTON _
or TDCBF_RETRY_BUTTON or TDCBF_CANCEL_BUTTON or TDCBF_CLOSE_BUTTON, TD_WARNING_ICON, @pnButton )
Select Case pnButton
Case IDOK
TaskDialog( Null, Null, "MyApp", "You clicked on OK button", "", Null, TD_INFORMATION_ICON, @pnButton )
case IDYES
TaskDialog( Null, Null, "MyApp", "You clicked on Yes button", "", Null, TD_INFORMATION_ICON, @pnButton )
case IDNO
TaskDialog( Null, Null, "MyApp", "You clicked on No button", "", Null, TD_INFORMATION_ICON, @pnButton )
CASE IDRETRY
TaskDialog( Null, Null, "MyApp", "You clicked on Retry button", "", Null, TD_INFORMATION_ICON, @pnButton )
case IDCANCEL
TaskDialog( Null, Null, "MyApp", "You clicked on Cancel button", "", Null, TD_INFORMATION_ICON, @pnButton )
case IDCLOSE
TaskDialog( Null, Null, "MyApp", "You clicked on Close button", "", Null, TD_INFORMATION_ICON, @pnButton )
End Select
Notice with the second message that there is no secondary message; it is not a requirement - we just use an empty string.
Now, if you want to be outrageous, which I do from the moment that I wake up, we can use own icon instead of a built in icon. However, we now need to use a resource file and a manifest. No big deal.
Save this snippet - TaskDialog2.bas
Code: Select all
#define UNICODE
#define _WIN32_WINNT &h0602
#include once "windows.bi"
#include once "win\commctrl.bi"
Dim as hInstance hInstance = GetModuleHandle(NULL)
LoadImage(hInstance, MAKEINTRESOURCE(100), IMAGE_ICON, 0, 0, LR_SHARED)
Dim pnButton as Long
TaskDialog( Null, hInstance, "MyApp", "Gimmee a break.", "Do you seriously expect me to do that!", TDCBF_YES_BUTTON, "#100", @pnButton )
TaskDialog( Null, hInstance, "MyApp", "OK", ".. but I really have better things to do, I really do.", Null, TD_INFORMATION_ICON, @pnButton )
and put the following two next to it.
TD.rc
Code: Select all
#define IDR_VERSION 1
100 icon what.ico
1 24 "Theme.xml"
Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity
version="1.0.0.1"
processorArchitecture="*"
name="MyAppName.exe"
type="win32"
/>
<description>Optional MyDescription for MyAppName.exe</description>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<!-- Compatibility section for Program Compatibility Assistant (PCA) -->
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<!-- Trustinfo section for User Account Control (UAC) -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<!-- level = "asInvoker" -->
<!-- level = "highestAvailable" -->
<!-- level = "requireAdministrator" -->
<requestedExecutionLevel
level = "asInvoker"
uiAccess = "false"
/>
</requestedPrivileges>
</security>
</trustInfo>
<!-- Dependency section -->
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
You will also need an icon. Try this one: What.zip and put with above.
Compile with: -gen gcc -Wc -O3 TD.rc
If that does not bring a smile to your face then I give up. <smile>