[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


ActiveX Server not Being Recognized

Posted on 2006-05-30
Medium Priority
Last Modified: 2010-04-07
VB6: For most of the time that I've worked with VB, I've built standard exe projects. I am now attempting to delve into greater things, although after getting my last problem fixed, I am wondering if it is worth it.

The project I am currently working on started out as a standard exe project. However, I have broken the data-centric classes into a spearate project and enabled it as an ActiveX EXE and the business objects into a project as an ActiveX dll.

I have been able to build the ActiveX exe project. I have the two projects in the same VB session within a project group. Now, when I try to complie the Business Object project, it gives me errors that the references to the data-centric objects stating: "User-defined type not defined"

My activeX exe is named HRPersist. In the case of the first error, I have the statements:

Public Sub Load(SearchText As String, SearchField As Long, Location As Long)
    Dim objPersist As cEmployeesPersist
    Set mcolDisplay = Nothing
    Set mcolDisplay = New Collection
    Set objPersist = CreateObject("HRServer.cEmployeesPersist")  ', PERSIST_SERVER)
'    Set objPersist = New cEmployeesPersist
    SetState objPersist.Fetch(SearchText, SearchField, Location)
    Set objPersist = Nothing
End Sub

The error references/highlights "objPersist As cEmployeesPersist" in the Dim objPersist As cEmployeesPersist statement.

Any ideas what I am doing wrong, or have failed to do?
Question by:dbbishop
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16793139
you probably did not add the HRServer dll in the project references?

you might also change the line into this:
    Dim objPersist As Object
LVL 15

Author Comment

ID: 16794030
I won't be able to try your second suggestion until tomorrow. And yes, I did add the server (it is an exe, not a dll) to the project references.

Expert Comment

ID: 16794858
It seems that your ActiveX EXE is running on another computer as a remote ActiveX Server. But it won't work unless you register it on your client computer.

If so, you must copy your ActiveX Exe to the client computer (which the Standard Exe runs on), and run it once. Then you can delete it and your code above will work.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 15

Author Comment

ID: 16797414
They are both on the same computer. I have not yet deployed it to another machine.
LVL 26

Accepted Solution

EDDYKT earned 2000 total points
ID: 16797711
if you press f2 to break up object browser from vb ide, do you see cEmployeesPersist?

If no, then make sure your class is set to multiuse from your activex exe
LVL 15

Author Comment

ID: 16798384
Got it. Somehow the Instancing got changed back to private. Not sure how it happened since I had copied everything into new directories and originally had all but two classes set to either MultiUse or PublicNotCreatable. Anyway got both the EXE and DLL to build.

I have another question. I am building all this based on Business Objects for VB6 by Rockford Lhotka. In his code, he is using late-binding for referencing the data-centric objects. As you can see, I originally had early-binding in my example above while designing everything within a single project. However, it has now been broken out into three seperate projects. Do I HAVE to use late-binding? Is there any reason I cannot keep the references early-bound?
LVL 26

Expert Comment

ID: 16798513
>>Do I HAVE to use late-binding?


>>Is there any reason I cannot keep the references early-bound?

no, the only reason if you use cross reference
i.e. exe1 reference to exe2 and exe2 reference back to exe1

then you may use late binding
LVL 15

Author Comment

ID: 16799329
I don't think there is any reason I need to have the ActiveX EXE (data-centric server) reference the DLL (business object). All it does is accept calls and data from the dll and return data to it, but it does not initiate any communication to the dll.

Why do you think Rockford used late-binding in his examples?
LVL 26

Expert Comment

ID: 16799572
no clue why but basically both shall work

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question