Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Task Panel
  New Posts New Posts RSS Feed - [SOLVED] TaskDialog doesn't support automation?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[SOLVED] TaskDialog doesn't support automation?

 Post Reply Post Reply
Author
Message
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED] TaskDialog doesn't support automation?
    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
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Willowmaster View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 July 2010
Location: Netherlands
Status: Offline
Points: 180
Post Options Post Options   Thanks (0) Thanks(0)   Quote Willowmaster Quote  Post ReplyReply Direct Link To This Post 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



Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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....
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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....
Back to Top
JantjeKeizer View Drop Down
Groupie
Groupie


Joined: 12 February 2008
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote JantjeKeizer Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
gibra View Drop Down
Senior Member
Senior Member


Joined: 31 October 2008
Location: Italy
Status: Offline
Points: 288
Post Options Post Options   Thanks (0) Thanks(0)   Quote gibra Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.