![]() |
[SOLVED] TaskDialog doesn't support automation? |
Post Reply ![]() |
Author | ||
gibra ![]() Senior Member ![]() Joined: 31 October 2008 Location: Italy Status: Offline Points: 288 |
![]() ![]() ![]() ![]() ![]() 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.
![]() |
||
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 |
||
![]() |
||
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1354 |
![]() ![]() ![]() ![]() ![]() |
|
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:
You can also handle events from the dialog, since you declared it WithEvents:
|
||
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
||
![]() |
||
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
|
try
Dim oTaskDialog As Object Set oTaskDialog = CreateObject("Codejock.TaskDialog.15.0.2") oTaskDialog.ShowDialog |
||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
||
![]() |
||
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1354 |
![]() ![]() ![]() ![]() ![]() |
|
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 |
||
![]() |
||
Willowmaster ![]() Senior Member ![]() ![]() Joined: 12 July 2010 Location: Netherlands Status: Offline Points: 180 |
![]() ![]() ![]() ![]() ![]() |
|
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 |
||
![]() |
||
SuperMario ![]() Admin Group ![]() ![]() Joined: 14 February 2004 Status: Offline Points: 18057 |
![]() ![]() ![]() ![]() ![]() |
|
Not true: Dim oTaskDialog As Object Set oTaskDialog = CreateObject("Codejock.TaskDialog." + XtremeSuiteControls.Version) oTaskDialog.ShowDialog |
||
![]() |
||
gibra ![]() Senior Member ![]() Joined: 31 October 2008 Location: Italy Status: Offline Points: 288 |
![]() ![]() ![]() ![]() ![]() |
|
Wow. This work fine.
![]() However to avoid updates to next release, I have changed the class name as:
Set oTaskDialog = CreateObject("Codejock.TaskDialog." & SuiteControlsGlobalSettings.Version)
![]() Thank oled.
![]() |
||
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 |
||
![]() |
||
gibra ![]() Senior Member ![]() Joined: 31 October 2008 Location: Italy Status: Offline Points: 288 |
![]() ![]() ![]() ![]() ![]() |
|
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.
![]() 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 |
||
![]() |
||
gibra ![]() Senior Member ![]() Joined: 31 October 2008 Location: Italy Status: Offline Points: 288 |
![]() ![]() ![]() ![]() ![]() |
|
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 |
||
![]() |
||
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1354 |
![]() ![]() ![]() ![]() ![]() |
|
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 |
||
![]() |
||
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1354 |
![]() ![]() ![]() ![]() ![]() |
|
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 |
||
![]() |
||
gibra ![]() Senior Member ![]() Joined: 31 October 2008 Location: Italy Status: Offline Points: 288 |
![]() ![]() ![]() ![]() ![]() |
|
However I solved the problem using the TaskDialog1 control contained in my frmMain.
![]() <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
![]() |
||
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 |
||
![]() |
||
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1354 |
![]() ![]() ![]() ![]() ![]() |
|
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 |
||
![]() |
||
Aaron ![]() Senior Member ![]() Joined: 29 January 2008 Status: Offline Points: 2192 |
![]() ![]() ![]() ![]() ![]() |
|
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.... |
||
![]() |
||
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1354 |
![]() ![]() ![]() ![]() ![]() |
|
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 |
||
![]() |
||
Aaron ![]() Senior Member ![]() Joined: 29 January 2008 Status: Offline Points: 2192 |
![]() ![]() ![]() ![]() ![]() |
|
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.... |
||
![]() |
||
JantjeKeizer ![]() Groupie ![]() Joined: 12 February 2008 Status: Offline Points: 70 |
![]() ![]() ![]() ![]() ![]() |
|
Why declare as object? You can still embed the typelib and create the object dynamically against the hard referenced variable.
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. |
||
![]() |
||
gibra ![]() Senior Member ![]() Joined: 31 October 2008 Location: Italy Status: Offline Points: 288 |
![]() ![]() ![]() ![]() ![]() |
|
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 |
||
![]() |
||
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1354 |
![]() ![]() ![]() ![]() ![]() |
|
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:
Thanks for any help/advice. |
||
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
||
![]() |
||
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1354 |
![]() ![]() ![]() ![]() ![]() |
|
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 |
||
![]() |
||
jpbro ![]() Senior Member ![]() ![]() Joined: 12 January 2007 Status: Offline Points: 1354 |
![]() ![]() ![]() ![]() ![]() |
|
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 |
||
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |