I've been searching the forum, and not finding anything that i really can understand.
I have a VB6 codebit:
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\Windows\system32\stdole2.tlb#OLE Automation
Reference=*\G{420B2830-E718-11CF-893D-00A0C9054228}#1.0#0#C:\Windows\system32\scrrun.dll#Microsoft Scripting Runtime
Reference=*\G{D1013DBC-2B99-419D-908F-023A0C4801E3}#1.0#0#..\..\Code\pstracking\bin\Release\pstracking.tlb#pstracking
Dim cfg As New Configurator
cfg.Configuration = ConfigM
If cfg.Show(Me.hWnd) Then
ConfigM = cfg.Configuration
End If
UpdateState
I downloaded the COMate and looked at the examples. Whats really confusing me is the "Dim XXX as New YYY" which i cant translate with createobject (which is the only way in pb, or is it?)
Can someone please help?
Jesper/Sweden
Converting from VB6 (ole/tlb/dll - Dim XXX as New YYY)
-
jesperbrannmark
- Enthusiast

- Posts: 536
- Joined: Mon Feb 16, 2009 10:42 am
- Location: sweden
- Contact:
You don't dim it as a new object like you did in vb6 when using comate, you just define and create the object, like this:
I'm not sure what your trying to do. Whats the ' Configurator' thing...a class or method or property? or something? You have a link to it in the MSDN maybe?
Code: Select all
Define.COMateObject objCfg
the you create it like this:
objCfg = COMate_CreateObject("Scripting.FileSystemObject") ; < or what ever your class/object is "Scripting.FileSystemObject" used in this example.
then after you do that you just use the methods or get the property values and stuff..
-
jesperbrannmark
- Enthusiast

- Posts: 536
- Joined: Mon Feb 16, 2009 10:42 am
- Location: sweden
- Contact:
I'm really loosing hair off this
It's a .net class (i guess, i'm noob at this)
I tried to put in a PrintN(Str(objCfg)) just to see if i got any return.
objCfg = COMate_CreateObject("Scripting.FileSystemObject")
I get a return value.
objCfg = COMate_CreateObject("{AAE39A12-9009-4C81-8CAB-77688C2EF64E}")
or "ClinicBuddy.PositionSense.Configurator" i get 0.
I put a screenshots at
http://www.clinicbuddy.com/ps.jpg
I cant find Scripting in the OLE/COM object viewer - where do you get that from?
It's a .net class (i guess, i'm noob at this)
I tried to put in a PrintN(Str(objCfg)) just to see if i got any return.
objCfg = COMate_CreateObject("Scripting.FileSystemObject")
I get a return value.
objCfg = COMate_CreateObject("{AAE39A12-9009-4C81-8CAB-77688C2EF64E}")
or "ClinicBuddy.PositionSense.Configurator" i get 0.
I put a screenshots at
http://www.clinicbuddy.com/ps.jpg
I cant find Scripting in the OLE/COM object viewer - where do you get that from?
If it is a .Net class then you will not be able to use it via COMate. You'd presumably need the CLR to perform all the necessary marshalling and I certainly have no experience with that kind of thing.
If you wish to access some .Net components then, to be honest, you should be using a .Net language.
If you wish to access some .Net components then, to be honest, you should be using a .Net language.
I may look like a mule, but I'm not a complete ass.
For:jesperbrannmark wrote:I'm really loosing hair off this![]()
It's a .net class (i guess, i'm noob at this)
I tried to put in a PrintN(Str(objCfg)) just to see if i got any return.
objCfg = COMate_CreateObject("Scripting.FileSystemObject")
I get a return value.
objCfg = COMate_CreateObject("{AAE39A12-9009-4C81-8CAB-77688C2EF64E}")
or "ClinicBuddy.PositionSense.Configurator" i get 0.
I put a screenshots at
http://www.clinicbuddy.com/ps.jpg
I cant find Scripting in the OLE/COM object viewer - where do you get that from?
objCfg = COMate_CreateObject("{AAE39A12-9009-4C81-8CAB-77688C2EF64E}")
a return of 0 would not be correct I think because its not ok. But it sort of looks like you want to drill down to the Configurator 'class' (if it is a class), ClinicBuddy.PositionSense.Configurator is basically the path to the class you want to work with which looks like 'Configurator' in which case it would look like this (I think):
Code: Select all
first create object:
objClinicBuddy = COMate_CreateObject("ClinicBuddy.PositionSense.Configurator")
then we have to get the object under that:
ObjPositionSense = objClinicBuddy\GetObjectProperty("PositionSense")
then we get the object for the class we are are going to work with
objConfigurator = ObjPositionSense\GetObjectProperty("Configurator")
Now we have a 'Configurator' object we can work with and can operate with the properties and methods in the 'Configurator' (if it is a class) by using:
objConfigurator\Invoke("SomeMethod('" + variable or value here + '")")
or...
objConfigurator\Invoke("SomeMethod('" + variable or value here + '", '" + another variable or value here + "' )")
objConfigurator\GetObjectProperty("SomeObject")
objConfigurator\SetObjectProperty("SomeProperty('")
ObjBody\SetProperty("SomeProperty = '" + some_value + "'")
some_string$ = objConfigurator\GetStringProperty("SomeProperty")
some_integer.i = objConfigurator\GetIntegerProperty("SomeProperty")
Last edited by SFSxOI on Mon Mar 09, 2009 4:06 pm, edited 2 times in total.
Yep,
try it like this and see if you still get a 0:
try it like this and see if you still get a 0:
Code: Select all
objClinicBuddy = COMate_CreateObject("ClinicBuddy.PositionSense.Configurator")

