Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3357908
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:41:21+00:00 2026-05-18T02:41:21+00:00

Is it possible to use a Windows 7 TaskDialog in PowerShell? I’d like to

  • 0

Is it possible to use a Windows 7 TaskDialog in PowerShell?

I’d like to convert the following messagebox to a TaskDialog:

[System.Windows.Forms.MessageBox]::Show(
    "There are currently one or more Microsoft Office applications running.`n`nYou must close down all open Office applications before the template update can continue.", 
    "Updating Templates", 
    [System.Windows.Forms.MessageBoxButtons]::RetryCancel, 
    [System.Windows.Forms.MessageBoxIcon]::Warning )

Anyone know how/if this can be done?

Thanks,

Ben

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:41:21+00:00Added an answer on May 18, 2026 at 2:41 am

    You need to use Microsoft’s Windows API CodePack for this, it’s very simple, but although it will work fine from PowerShell ISE, PoshConsole, PowerGUI etc — I don’t believe it will work in PowerShell.exe because the console loads the wrong version of comctl32.dll (the common controls library).

    # import the library dll from wherever you put it:
    add-type -path .\Libraries\Microsoft.WindowsAPICodePack.dll
    
    # Create and configure the TaskDialog
    $td = New-Object Microsoft.WindowsAPICodePack.Dialogs.TaskDialog
    $td.Caption = "Updating Templates"
    $td.Text = "There are currently one or more Microsoft Office applications running.`n`nYou must close down all open Office applications before the template update can continue."
    $td.StandardButtons = "Retry,Cancel"
    $td.Icon = "Warning"
    
    # Show the dialog and capture the resulting choice
    $result = $td.Show()  # will return either "Retry" or "Cancel" 
    

    Hopefully it’s obvious that the $result value is actually an enumeration value (of type [Microsoft.WindowsAPICodePack.Dialogs.TaskDialogResult]) … but in PowerShell you can basically treat it as a string or an int if you like.

    Of course, this is barely scratching the surface of what you can do with a TaskDialog — if you use it with just this code, it will look and behave very similarly to your current dialog — but you can explore the other possibilities yourself — I can recommend the TaskDialog builder tool from this MSDN Magazine Article as a way to learn the many options.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We use Windows Forms and custom user controls, and I would like to be
Is it possible to use an UnhandledException Handler in a Windows Service? Normally I
It's possible, but is it appropriate to use SHFileOperation within a Windows service? All
Is it possible to use this Role Provider AspNetWindowsTokenRoleProvider with ASP.NET FORMS Authentication (via
Is it possible, safe and practical to use Windows Integrated Security on an Extranet?
Does anybody know if it's possible to set up MSSQL 2008 to use Windows
Is it possible to use the FromStream method of System.Drawing.Image without having to keep
Is it possible to use Windows phone 7's camera in Silverlight in ANY way?
EDIT: Is it possible to use Entity Framework with Windows Azure development storage service?
Possible Duplicate: Which version of Perl should I use on Windows? I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.