Print Page | Close Window

TaskDialog MainIconHandle

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: General Discussion
Forum Description: Topics Related to Active-X COM Development in General
URL: http://forum.codejock.com/forum_posts.asp?TID=9492
Printed Date: 21 November 2024 at 2:36pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: TaskDialog MainIconHandle
Posted By: jpcoffeyXXX
Subject: TaskDialog MainIconHandle
Date Posted: 04 February 2008 at 4:48pm
I'm having a problem with the TaskDialog MainIconHandle.  I'm trying to assign a 32 pixel icon to the TaskDialog MainIcon and it will not show.  While I can get the icon to show using the API method provided in the example, I cannot see why CodeJock's own control cannot deliver the handle.  The code I am using is,

   
    Dim imgIcon As ImageManagerIcon, lngIconHandle As Long
    Dim td as TaskDialog

    Set imgIcons = MyForm.cjImageManagerIcons
   
Set imgIcon = imgIcons.Icons.GetImage(ID_TASK_DIALOG_ICON, 32)
    lngIconHandle = imgIcon.Handle
 
   
Set td = MyForm.cjTaskDialog
    With td
        .MainInstructionText = "CJ image handles do not work."

        .MainIcon = xtpTaskIconCustom
        .MainIconHandle = lngIconHandle
        .ShowDialog
     end with

    Set td = Nothing
    Set imgIcon = Nothing: Set imgIcons = Nothing

The only thing showing up on the TaskDialog is the MainInstructionText.  The image in the ImageManagerIcons is an XP icon with multiple sizes.  Is there something I'm missing?  Thanks for your help.

Sincerely,

John
   





Replies:
Posted By: Aaron
Date Posted: 05 February 2008 at 3:06am
Hi,
 
Yes it's a little strange that the control doesn't deliver the handle.
I also wanted to do simular what you wanted. This is what I found so far:
 
Dim stdPic As StdPicture
Set stdPic = ImageManager.Icons.GetImage(ID_TASK_DIALOG_ICON, 32).CreatePicture(xtpImageNormal)
   
    With taskDialog
        .MainInstructionText = "Some text...."
        .MainIconHandle = stdPic.Handle
        .MainIcon = xtpTaskIconCustom
        .ShowDialog
    End With
 
 


Posted By: jpcoffeyXXX
Date Posted: 05 February 2008 at 8:33am
Aaron, thank you for the solution. 

A caveat to everyone who is trying to accomplish the same thing, you cannot use an icon with an alpha channel with the StdPicture object.  Initially when I implemented the solution it didn't work.  After removing the icon with the alpha channel from the ImageManager and substituting an icon with 256 colors it worked beautifully.  The weak link here is the StdPicture object which does not support icons with alpha channels.  Again, Aaron thanks for your help.

Sincerely,

John


Posted By: McKloony
Date Posted: 03 June 2008 at 6:58am
Yes, this works great. Do you know, if it is possible to set Icons bigger than 32 x 32? I tryed out with 48 x 48 icons and it was reduced to 32 x 32

-------------
Product: Xtreme SuitePro (ActiveX) 16.2.5

Platform: XP / Windows 7

Language: Visual Basic 6.0 SP6


Posted By: jpcoffeyXXX
Date Posted: 03 June 2008 at 8:21am
McKloony, I don't know if 48 x 48 icons will work.  Sorry. 

If not, it would be a limitation of the TaskDialog, but probably by design.  When CodeJock created the TD control, I am sure they built it within the design specs supplied by Microsoft.

Cheers,

John



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net