Author Topic: Create new extensions objects on the fly  (Read 6211 times)

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Create new extensions objects on the fly
« on: October 02, 2008, 05:00:00 AM »
Hi guys,
I have a dumb question but I have forgot how to do it...  :-\
I have my VB 6 project with ActiveX for monitor some extensions, now I need to create extensions (TExtension) object on the fly meaning add more of them to monitor more DNs based on some events.

I'm trying to do:

Dim vExtension As DesktopToolkitX.TExtension
Set vExtension = New DesktopToolkitX.TExtension

However it is not working  :-\

Can somebody please refresh my mind???

Thanks!

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Create new extensions objects on the fly
« Reply #1 on: October 03, 2008, 01:52:38 AM »
Nobody?...

Offline Jiggolo

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Create new extensions objects on the fly
« Reply #2 on: October 03, 2008, 07:14:23 AM »
Hello Cavagnaro
I used to implement VB6 with ActiveX.  I created a TExtension object on my form and make index for this object is 0.

This is TExtension create:

For i =1 to numExt
      '***Create TExtension object
      Load myForm.TExtension(i)
        myForm.TExtension(i).ConnectionName = TConnection.ConnectionName
        myForm.TExtension(i).ExtensionName = "TExtension" & i
        myForm.TExtension(i).TDN = TDN
        myForm.TExtension(i).TQueue = TQueue
Next i

This is TExtension Event on the form:

Private Sub TExtension_TEvent(Index As Integer, EventInfo As DesktopToolkitX.TEventInfo)
'**** Event data
End sub

I am not sure these are solution you mean or not.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Create new extensions objects on the fly
« Reply #3 on: October 03, 2008, 08:23:02 PM »
;D not exactly but I can work with this  ;D Thanks a lot for the idea  :D

Offline victor

  • Administrator
  • Hero Member
  • *****
  • Posts: 1416
  • Karma: 18
Re: Create new extensions objects on the fly
« Reply #4 on: October 06, 2008, 02:26:12 AM »
Hi, Cav,

what is wrong with this one?

Vic

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Create new extensions objects on the fly
« Reply #5 on: October 06, 2008, 02:58:24 AM »
I was thinking on how to create an extension each time I receive an event that is under a public function. I believe with this I can do the job, will move on and update :)
Thanks a lot

Offline victor

  • Administrator
  • Hero Member
  • *****
  • Posts: 1416
  • Karma: 18
Re: Create new extensions objects on the fly
« Reply #6 on: October 06, 2008, 04:23:40 AM »
I think this should do the job. Just make sure to add the object in a form first with index 0. :)
I still have to figure out how to do it without having a form thought :(

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Create new extensions objects on the fly
« Reply #7 on: October 06, 2008, 04:50:17 AM »
Yeah, would like that too, I have been testing and no good result with my code, don't know what can be missing

Offline barleycorn

  • Jr. Member
  • **
  • Posts: 73
  • Karma: 2
Re: Create new extensions objects on the fly
« Reply #8 on: October 06, 2008, 05:12:15 AM »
I haven't used VB6 in years now, but seem to remember doing something similar to this too.  Is it possible that the control needs a parent (typically a form)? If so, you could just have a non-visible form, or an non-visible panel object as its parent, or something like that.
It's interesting.... I might have to dig out my Windows 2000 virtual machine to play around with it. :-)

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Create new extensions objects on the fly
« Reply #9 on: October 06, 2008, 05:31:59 AM »
Thanks for the idea, will try that as well, however the perfect scenario is that no form is needed. Something to be able to use like a DLL...