Print Page | Close Window

[SOLVED] TaskDialog doesn't support automation?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Task Panel
Forum Description: Topics Related to Codejock Task Panel
URL: http://forum.codejock.com/forum_posts.asp?TID=18254
Printed Date: 28 April 2024 at 2:53pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [SOLVED] TaskDialog doesn't support automation?
Posted By: gibra
Subject: [SOLVED] TaskDialog doesn't support automation?
Date Posted: 21 April 2011 at 7:55am
I tried to create a TaskDialog (v.15.0.2) using CreateObject:
 
        Dim oTaskDialog As Object
        Set oTaskDialog = CreateObject("XtremeSuiteControls.TaskDialog")

 
but I get the error 429: ActiveX component can't create the object.
Then I think that TaskDialog doesn't support Automation...
 
My problem is that I need shows a TaskDialog from the starting Sub Main() procedure,
but nothing forms are loaded, at this moment, only the BAS module is running.
 
This because if some conditions are False I don't show Login form, but end directly the program.
 
It's possible? There a way to do it?
 
Thank. Smile


-------------
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8



Replies:
Posted By: jpbro
Date Posted: 21 April 2011 at 8:46am
What I've done is create a separate DLL to handle custom dialog creation. The trick is to add a reference (Projects menu > References) to the SuiteControls OCX instead of adding it as a component.

Unfortunately, you can't have the same OCX added as a reference and a component in the same project, hence the need to make a separate DLL (or only use the reference and never have a TaskDialog control placed on any of your forms).

You can then do something like:


Private WithEvents mo_Dialog As XtremeSuiteControls.TaskDialog

Private Sub Class_Initialize()
   Set mo_Dialog = New XtremeSuiteControls.TaskDialog
End Enum

Public Function ShowCustomDialog(byval p_Message As String) As Long
   With mo_Dialog
      .Reset
      
      ' Set properties that you commonly use for your dialogs
      ShowCustomDialog = .ShowDialog
   End With
End Sub


You can also handle events from the dialog, since you declared it WithEvents:


Private Sub mo_Dialog_Timer(ByVal MilliSeconds As Long, Reset As Variant)
   Debug.Print Milliseconds
End Sub



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Oleg
Date Posted: 21 April 2011 at 9:17am
try

      Dim oTaskDialog As Object
        Set oTaskDialog = CreateObject("Codejock.TaskDialog.15.0.2")
        oTaskDialog.ShowDialog


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jpbro
Date Posted: 21 April 2011 at 9:59am
That works Oleg, but unfortunately you lose Intellisense (may or may not be a problem depending on the circumstances). It seems you can't coerce the object to XtremeSuiteControls.TaskDialog (type mismatch error).



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Willowmaster
Date Posted: 21 April 2011 at 10:47am
Also when updating to 15.0.3 or any other higher version you have to remember to change this line of code.

-------------
Product: Xtreme SuitePro (ActiveX) version 15.3.1

Platform: Windows XP (32bit) - SP 3 (on VMWare)

Language: Visual Basic 6.0





Posted By: SuperMario
Date Posted: 21 April 2011 at 2:08pm
Originally posted by Willowmaster Willowmaster wrote:

Also when updating to 15.0.3 or any other higher version you have to remember to change this line of code.


Not true:

      Dim oTaskDialog As Object
        Set oTaskDialog = CreateObject("Codejock.TaskDialog." + XtremeSuiteControls.Version)
        oTaskDialog.ShowDialog



Posted By: gibra
Date Posted: 21 April 2011 at 4:42pm
Originally posted by oleg oleg wrote:

try
      Dim oTaskDialog As Object
        Set oTaskDialog = CreateObject("Codejock.TaskDialog.15.0.2")
        oTaskDialog.ShowDialog
 
Wow. This work fine. Big smile
However to avoid updates to next release, I have changed the class name as:
 
Set oTaskDialog = CreateObject("Codejock.TaskDialog." & SuiteControlsGlobalSettings.Version)
Wink
 
 
Thank oled.
Clap


-------------
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8


Posted By: gibra
Date Posted: 21 April 2011 at 4:50pm
Originally posted by SuperMario SuperMario wrote:

         Set oTaskDialog = CreateObject("Codejock.TaskDialog." + XtremeSuiteControls.Version)
 
 
OPS! I have read your post after found a different solution.
 
However i think that using
Set oTaskDialog = CreateObject("Codejock.TaskDialog." & SuiteControlsGlobalSettings.Version)
is same thing, or not?
 
Thank.
 
 
Wacko Sorry, I see that I have posted in wrong section (TaskPanel) instead of SuiteControls...
Please forgive me.


-------------
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8


Posted By: gibra
Date Posted: 23 May 2011 at 4:47pm
Hi to all.
 
Unfortunately, I discover that the instruction:
 
Dim oTaskDialog As Object
Set oTaskDialog = CreateObject("Codejock.TaskDialog." + XtremeSuiteControls.Version)
 
work correctly ONLY if I run the project from VB6 IDE, but doesn't work in executable deployed.
The above instruction generate a error 429 (ActiveX component can't create the object).
I have tested on Windows 7 'real machine' and a Windows 7 'virtual machine' with same result.
 
After this error (intercepted) the application work fine, and all taskdialog routines are executed with no errors.
 
Any idea?
 
 
 


-------------
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8


Posted By: jpbro
Date Posted: 23 May 2011 at 6:48pm
Funny I just encountered this exact problem with the PopupControl at the same time you discovered it :(

No solution yet.


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: jpbro
Date Posted: 23 May 2011 at 6:58pm
Strangely - it works compiled on my Dev box (Win2k), but fails on my test box (Win7).

I don't know if it is a Win7 problem, or if it is a registration problem on machines where the controls aren't installed using the CJ installer?




-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: gibra
Date Posted: 24 May 2011 at 9:15am
However I solved the problem using the TaskDialog1 control contained in my frmMain. Wink
 
<from modMain.bas>
Public Sub Main()
 
    Dim oTaskButton As TaskDialogCommonButtons
    Dim oTaskDialog As Object
   
    ' this doesn't work
    Set oTaskDialog = CreateObject("Codejock.TaskDialog." & XtremeSuiteControls.Version)
   
    'this work
    Set oTaskDialog = frmMain.TaskDialog1
    With oTaskDialog
        ' my code
    End With
 
End Sub
 
Smile


-------------
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8


Posted By: jpbro
Date Posted: 24 May 2011 at 9:52am
Yeah, I'm using a PopupControl on a form now too - unfortunately not the same as creating it from code only, but I guess it will have to do.



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Aaron
Date Posted: 24 May 2011 at 1:24pm
Hi,
 
Gibra:
 
I tried on XP and in IDE and exe run properly
 
Dim oTaskDialog As Object
    Set oTaskDialog = CreateObject("Codejock.TaskDialog." & XtremeSuiteControls.Version)
          oTaskDialog.ContentText = "test"
          oTaskDialog.ShowDialog
 
 
 
Jason:
Did you declare object as "global" ?
 
If you create object it's lifecycle is within the function you declare the object. My best guess would be that "Windows Garbage Collector" destroying the object right after the function or sub ends

    Set oPopup = CreateObject("Codejock.PopupControl." & XtremeSuiteControls.Version)
        oPopup.ShowDelay = 5000
        oPopup.Animation = xtpPopupAnimationFade
        oPopup.AnimateDelay = 15000
        oPopup.Show
        
        'this will prevent the popupControl from closing immediately when function or sub ends
        'if you comment MsgBox the Popup control won't show (maybe as a flicker)       
        MsgBox ""
 
 
Option Explicit
Dim oPopup As Object 'This would hold the object as long as you don't destroy it
 
Private Sub Command1_Click()
    
    Set oPopup = CreateObject("Codejock.PopupControl." & XtremeSuiteControls.Version)
          oPopup.ShowDelay = 5000
          oPopup.Animation = xtpPopupAnimationFade
          oPopup.AnimateDelay = 15000
          oPopup.Show
           
End Sub
 
And again both run properly in IDE and exe
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: jpbro
Date Posted: 24 May 2011 at 2:19pm
I did declare it as a module level variable, same problem - did you try running the EXE on a computer that hasn't had the suite installed using the Codejock installer (that is, installed using your own installer)? I don't have a problem when I run compiled on my development machine, just on one of my test deployment machines.

-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Aaron
Date Posted: 24 May 2011 at 2:38pm
Originally posted by jpbro jpbro wrote:

I did declare it as a module level variable, same problem - did you try running the EXE on a computer that hasn't had the suite installed using the Codejock installer (that is, installed using your own installer)? I don't have a problem when I run compiled on my development machine, just on one of my test deployment machines.
 
Hi Jason,
 
I haven't installed V15.0.2 on my Office PC so if I register only SuiteControls.OCX on that PC (registering is enough?) you say it won't work? OK, I will try that and report back inhere.
 
Thanks
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: JantjeKeizer
Date Posted: 24 May 2011 at 4:45pm

Why declare as object? You can still embed the typelib and create the object dynamically against the hard referenced variable.

Dim bla as TaskDialog

Set bla = CreateObject("Codejock.TaskDialog." & XtremeSuiteControls.Version)

You'll need to recompile anyway when you upgrade your Codejock for the next reason, which is probably also why it only works on your dev machines:

You need to include license info when creating Codejock controls dynamically via the Globalsettings object.

Also, this way you'll have your intellisense back.



Posted By: gibra
Date Posted: 24 May 2011 at 5:20pm
Originally posted by Aaron Aaron wrote:

Hi,
 
Gibra:
 
I tried on XP and in IDE and exe run properly
 
Dim oTaskDialog As Object
    Set oTaskDialog = CreateObject("Codejock.TaskDialog." & XtremeSuiteControls.Version)
          oTaskDialog.ContentText = "test"
          oTaskDialog.ShowDialog
 
 
Then?
I specified that  doesn't work on Windows 7 64bit.
 
My customer also own Windows 7 64bit.


-------------
gibra
CJ SuiteControl v: 13.x to 19.x
Windows 10 64bit
VS2019 - VB6.0 SP6
<a href="http://nuke.vbcorner.net/Home/tabid/36/language/en-US/Default.aspx" rel="nofollow">VS/VB 6.0 Installer v6.8


Posted By: jpbro
Date Posted: 06 October 2011 at 9:16am
I'm still trying to get the CreateObject method to work, but it is failing on Windows 7 - has any body got this working?

Whether I've added the Suite Controls OCX as a Reference or as a Component, I get errors. In the case of Reference, the error is ActiveX can't create component, in the case of Component, the error is Type Mismatch Error.

My current code:


Public Function libnewTaskDialog() As XtremeSuiteControls.TaskDialog
   Static s_LicenseSet As Boolean
  
   On Error GoTo ErrorHandler

   If Not s_LicenseSet Then
      SuiteControlsGlobalSettings.License = <MY LICENSE INFO>
      s_LicenseSet = True
   End If

   Set libnewTaskDialog = CreateObject("Codejock.TaskDialog." & XtremeSuiteControls.Version)  
End Function


Thanks for any help/advice.


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: jpbro
Date Posted: 06 October 2011 at 9:18am
Note: I'd rather not add a hidden form with just a TaskDialog if at all possible

-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: jpbro
Date Posted: 06 October 2011 at 9:50am
Never mind - it appeared to be a problem with my license information (forgot newline characters between lines). Problem solved.



-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6




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