• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

Late binding question

Currently, I have a VB6 ActiveX EXE which is located on a server. I have numerous progams that use this ActiveX EXE. I have used early binding in all these programs.
Whenever a change is made to the ActiveX EXE which breaks compatibility, I have to unregister than Re register the ActiveX EXE in all the projects. This happens a couple of times a year.
It is my understanding that with late binding this would not be necessary. Is this correct?
I tried to experiment with the late binding but was not able to create the object.

Dim objWP as Object

objWP = CreateObject("WPExe.exe","\\FileServer\Code")

This code failed.
I also tried
objWP = CreateObject("WPProject.Class1","\\FileServer\Code")
This also failed. I have never installed or registered the ActiveX EXE on the server(FileServer).

What would be the correct way to accomplish this.
0
mpdillon
Asked:
mpdillon
  • 3
  • 3
1 Solution
 
23637269Commented:
Yes that is correct.
When you use early binding you can enjoy the text assist when coding.

To get the best of both worlds keep it bound while in development mode then when ready to compile a release uncheck the reference.

The way that I took care of updating multiple systems in the field was to create a standalone exe that would just start and check the update folder on the server to see if there are any updates.  If there were they would be copied down.  You can also run RegSvr to register any OCXs' or DLLs'.  After everything is updating the updater program would end and start the normal program exe.  The reason that end user shortcut starts the updater and not the normal exe is that you can't update the exe if it is running.

Thanks
Roger
0
 
mpdillonAuthor Commented:
Roger,
Thanks for confirming my belief that late binding would solve the registration prolem. However, I cannot get the ActiveX exe on th e Server to register on the server. Also I cannot get the Create Object code to run without error. Any insights on these two points?
0
 
willibob1909Commented:
If the EXE is running on the remote machine (and it has been set up to allow remote access) you only need to pass the machine name as the second argument.

The following snippet is taken from 'http://msdn2.microsoft.com/'. If you search there for 'CreateObject' you will find more details.

Sub CreateRemoteExcelObj()
   Dim xlApp As Object
   ' Replace string "\\MyServer" with name of the remote computer.
   xlApp = CreateObject("Excel.Application", "\\MyServer")
   MsgBox(xlApp.Version)
End Sub

Hope this helps.

Bill
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
mpdillonAuthor Commented:
Bill,
Sorry for the long delay in my response. I believe you are on the right track. Here is my code.
Dim objWP as object
objWP = CreateObject("WPProjectX.Class1,"\\MyServerName")

At this point I receive a "Run Time Error 91.  Object variable or With Block not set ."

I am trying to running this ActiveX exe application(WPProjectX) on a workstation. However, the actual exe(WPProject.exe) resides on MyServer. I looked in the registry on the server and found the following keys(?)
Implemented Categories
ProgID
Programmable
TypeLib

In the ProgID key was the default value "WPProjectX.Class1"

This ActiveX exe does not continuously run in the background. Rather, every time it is called by a workstation, a new instance is created on the workstation and then destroyed when the calling app closes.
This has worked fine for some time when I use early binding. But I would like to use late binding. This will make changes to the exe easier to implement and expand my knowledge of how VB works.
thanks again for any addtional help you might provide.
pat
Version
0
 
23637269Commented:
Set objWP = CreateObject("WPProjectX.Class1,"\\MyServerName")
0
 
mpdillonAuthor Commented:
Roger,
Thanks for your reply. I made the change by adding SET to my code. However, it still does not function. But I did get a new error message. That message is:

The remote server machine does not exist or is unavailable.

Any thoughts?
pat
0
 
23637269Commented:
Do you ReRegister by using RegSvr.exe (for 16 bit ocx, dll, etc) and RegSvr32.exe (for 32 bit ocx, dll, etc)?
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now