Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Createobject does not work

Status
Not open for further replies.

baseballgem

Programmer
Oct 3, 2001
54
0
0
US
I wrote DLL (Single Thread COM server) in VFP Ver 8. I used install shield to cut the CD. I brought in all the necessary compnents - I assume.
In the past I have done this to quit considerable success in other areas, VB ASP Excel, Stand Alone VFP.

The objective in this case is different. I have to instantiate the object from within Access. The instantiation was placed in Access' autoexec as I see other Createobjects placed.

The syntax in VB is
Dim adrx as Object
Set adrx = Createobject("Street.BaseAddress")
It is this 2nd line that fails.

The error was something like "Can not create ActiveX component Street". CAN NOT GET PASSED THIS.

The DLL is installed in Windows Registry, we even registered the "Street.tbl" in Access (under tools). It fails in Access97 and Access2000. Are there any other files that "must" be included with the install. I'm truly perplexed. What am I missing?
 
Can you bring up the Visual Basic Editor and create the object in a dummy function?

i.e.
Private Sub testObject()
Dim o As Object
Set o = CreateObject("Street.BaseAddress")
End Sub

If not, I'd assume your dll is either not truly registered
properly on the system(although from your post it seems so),
or there is something awry in the intantiation of the dll itself.

Make sure there is a progid in the registry for Street.BaseAddress.

Darrell
 
As an example I just created a simple project with the following code in a prg called 'Startup'.


Code:
DEFINE CLASS clsOlePub AS CUSTOM OLEPUBLIC
  cData = ""

  PROCEDURE setDatac(vValue)
    THIS.cData = vValue
  ENDPROC

  FUNCTION getDatac()
    RETURN THIS.cData
  ENDFUNC

ENDDEFINE

DEFINE CLASS clsOlePub2 AS CUSTOM OLEPUBLIC
  cData = ""

  PROCEDURE setDatac(vValue)
    THIS.cData = vValue
  ENDPROC

  FUNCTION getDatac()
    RETURN THIS.cData
  ENDFUNC

ENDDEFINE

The project name is TestVFPDll so the registered classes
with be TestVFPDll.clsOlePub and TestVFPDll.clsOlePub2.


In Access the following works fine.

Code:
Private Sub testVfpDll()
  Dim o1 As Object, o2 As Object

  Set o1 = CreateObject("testvfpdll.clsOlePub")
  Set o2 = CreateObject("testvfpdll.clsOlePub2")

  o1.SetDataC ("Hello")
  o2.SetDataC ("GoodBye")

  Debug.Print o1.GetDataC()
  Debug.Print o2.GetDataC()
  
  o1.SetDataC(o2.GetDataC())
  Debug.Print o1.GetDataC()

  Set o1 = Nothing
  Set o2 = Nothing
End Sub

Darrell

 
baseballgem

Have you tested it with VFP? Can you instanciate it?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Yes I can instantiate it in VFP.

There is 1 machine where it works but that computer had 3 VFP (vers8) exe's installed on it. Perhaps other compontents got registered behind the scenes; thereby it succeeds there.

I wanted to try it out on a computer that had Access but no VFP whatsoever. On those it fails.

Side Note:
Interestingly enough, on another non-VFP developer station someone was writing in .NET and after the declaring statements -then the properties of my dll popped up in the intellisense - it's non-protected properties and methods were there. And that was at design time. Imagine that. But at run time it too failed to instantiate. COM is frustrating. We even tried re-booting the computer to start up fresh. No luck so far.
 
This may be a silly question, but are the VFP runtime
libraries installed properly on the machines in question?

Darrell
 
My response to .. "are the VFP runtime
libraries installed properly on the machines in question?"

To that I would say I am using the Install Shield that came with VFP8. It tells you to include the C++ runtimes, VB libraries and the VFP8 runtimes and a couple of other things. I have built other Visual apps with this in likewise fashion with the inclusions in install shield (they installed perfectly.)

I am relying on the install to take care of the details.
I hope it did when I installed from the CD.

Maybe I'll do a complete re-write and try it all over again.
I'll be back.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top