Click to See Complete Forum and Search --> : CreatObject problem
mchu7aa3
Apr 25th, 2002, 06:23 AM
HI, I have a visual basic ActiveX dll (prog.dll) with a class (Class1.cls) and want to run it on an NT machine, i also have a visual basic EXE which i want to run on another machine and it calls functions within Class1 of prog.dll. i tried
CreateObject("prog.Class1", "ServerName")
but it throws an error: that it can't find the server. WHAT should i do???
i have also regsvr32.exe prg.dll on the server!!
do i have to include a reference of the dll in the exe??
Arc
Apr 25th, 2002, 10:19 PM
Make sure you have the correct Servername. Servername is the name of the Computer where the Obj is. If the Obj is on your computer then just leave that argument off like this
Set MyOBject = CreateObject("prog.Class1")
Else
Set Myobj = CreateObject("prog.CLass1", "OEMCOMPUTER")
Where OEMCOMPUTER is the name of the computer on the network. OEMCOMPUTER is the name of my computer, you would have to change that ofcourse.
Edneeis
Apr 25th, 2002, 11:12 PM
I think you have to register a dll with DCOM to use it on another computer. Or maybe there is an option when you compile this that does it also. Because even though the dll doesn't have to reside on the machine using it, it does have to be registered on that machine.
Arc
Apr 25th, 2002, 11:27 PM
Why would the DLL have to be registered on the machine that is calling it? Isnt all the work being done on the foriegn computer? Seems to me if the other computer is the only one using the DLL then your computer doesnt need to register it. After all isnt your computer only recieving the info back from the DLL and not actually doing any processing?
i've never done it so i'm just guessing:D
Edneeis
Apr 26th, 2002, 12:10 AM
Well I'm not 100% sure that it does but I remember reading something about it. I've only done that (used a dll on another machine) once before and I don't remember how I did it but I believe I had to register it with DCOM on the target machine. I have 2 machines here I'll find out for sure for us.
Where is Jim McNamara he'll know, that guy knows everything.
Edneeis
Apr 26th, 2002, 12:23 AM
Well I tested it and got an 'Object not registered on Local Machine' error. Now I'm going to try registering it with DCOM and see if the error goes away.
Arc
Apr 26th, 2002, 12:45 AM
While yer at it explain what DCOM is and how to use it :p
Edneeis
Apr 26th, 2002, 01:34 AM
Well DCOM is basically remote COM as far as I understand it, but it appears that I don't understand it too well. Well I got confused poked around a bit, searched the net, and got to work (almost). I added the dll on the 'server' machine as a COM+ app in the component services (we need a tutorial on this) and then started it and exported it (which creates a little .msi file). I then installed the msi thing and it set it up on the client machine for DCOM (since I couldn't figure out how to do it manually, this seems like it was much easier on win 9x). Then it stopped giving me that error but then I got a permission error.
Hmm well this permission denied deal has begun to bother me now.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.