Click to See Complete Forum and Search --> : DCOM and Error 48
I have a client application that connects to two different class objects. On the local machine everything works fine.
On the remote machine, the class without events works fine (just calling a function), but the class with events gives me "Error 48 cannot load dll". The remote machine is Windows 2000 SP1, Local Machine is NT 4.0 Sp6. If I step through in debug mode, the error occures immediately after the get property statement below (which I see executing after the class is initialized )
Option Explicit
Public Property Get clsEserverConnect() As clseserver
Set clsEserverConnect = gclsEserver
End Property
'error occurs after End Property but only at the remote machine
'These execute fine
Private Sub Class_Initialize()
If gclsEserver Is Nothing Then
Set gclsEserver = New clseserver
End If
glngUseCount = glngUseCount + 1
End Sub
Private Sub Class_Terminate()
glngUseCount = glngUseCount - 1
If glngUseCount = 0 Then
Set gclsEserver = Nothing
End If
End Sub
Any help greatly appreciated.
It looks as though you're trying to use dcom(as i read the subject), but are you? Is there a client app on one machine trying to use a COM component on another machine? I ask because your naming convention indicates you're using classes within the same project and not dcom. Also, that property get looks like it's set up to use a class within the project, if not you're gonna wanna re-think your approach. DCOM apps are designed a bit different(or at least they should be if you want them to work well) than your local COM components.
Option Explicit
Public Property Get clsEserverConnect() As clsEserver
Set clsEserverConnect = gclsEserver
End Property
Private Sub Class_Initialize()
If gclsEserver Is Nothing Then
'***********************************
Set gclsEserver = New clsEserver
'Is clsEserver on a remote machine?
'or is it within the same project?
'***********************************
End If
glngUseCount = glngUseCount + 1
End Sub
Private Sub Class_Terminate()
glngUseCount = glngUseCount - 1
If glngUseCount = 0 Then
Set gclsEserver = Nothing
End If
End Sub
--maybe add some details about your environment and how you set up your project would help a little.
1. how did you set up the DCOM Server application?(the one on the remote machine)
2. how did you set up the reference to the DCOM app on the client?(dcomcnfg.exe?)
3. did you use the package and deployment wiz?(if so did you include the .vbr file that was generated when you compiled your dcom component?...did you generate the .vbr file when you compiled your dcom server?)
Well I am trying to use DCOM :) The code snippet is from the server connector class. There are two classes in the server ActiveX exe. The first is the 'real' class (Public not creatable). The second is the connector class (snippet above). It is set to Multiuse. The purpose is to have one instance of the first class and all connecting clients get a reference to that object.
This is the declaration in the client app in a form.
Option Explicit
Dim WithEvents Myevent As clseserver
Dim MyConnect As clsconeserver
Dim MyCommandConnect As clsconcommand
Dim MyCommand As clscommand
Private Sub cmdconnect_Click(Index As Integer)
Select Case Index
Case 0'Connect to server object
Set MyConnect = New clsconeserver
Set Myevent = MyConnect.clsEserverConnect
Case 1'disconnect from server object
Set MyConnect = Nothing
Set Myevent = Nothing
End Select
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0'Connect to server object
Set MyCommandConnect = New clsconcommand
Set MyCommand = MyCommandConnect.clsEvent
Case 1'Disconnect to server object
Set MyCommandConnect = Nothing
Set MyCommand = NothingEnd Select
End Sub
Follow Up on the questions.
1. how did you set up the DCOM Server application?(the one on the remote machine)
The remote machine is my development machine at this point. I did use dcomcnfg.exe to configure the class permissions. I added the interactive user and gave him full permissions. The interactive user is configured to launch. Remote machines are a W2K laptop, W2K WS, NT 4.0 WS, and a Win98SE machine. I get the same error 48 on all. the command class works on all.
2.. how did you set up the reference to the DCOM app on the client?(dcomcnfg.exe?)
The reference to the server app is early bound using the new operator in the snippet above. I think this is what you where asking?
3. did you use the package and deployment wiz?(if so did you include the .vbr file that was generated when you compiled your dcom component?...did you generate the .vbr file when you compiled your dcom server?)
I checked binary compatibility and remote server files. I used the pdw (hate it but i used it) and I included the .vbr and .tlb files. When I install on the remote clients, the install asks for the computer name where the server components are located. after install, the command class works without any other changes at the client (remote), just the install. I have tried using dcomcnfg to change the identity to impersonate and change the access permissions for the client. The reason I did this is because unlike the command class (that works), the eserver class has a withevents declaration on the client. I would really like to keep this approach. I am looking at using callbacks if I cannot get this to work this week.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.