Link to home
Create AccountLog in
Avatar of Eamon
EamonFlag for Ireland

asked on

MSCOMM

Why does this work on my computer

Dim MSComm1 As Object
Set MSComm1 = CreateObject("MSCOMMLib.MSComm")

but it does not work on another computer that has MSCOMM32.OCX in the system32 folder and it is registered.

I get an error Activex component cannot create object.

I do not want to add a reference to the Microsoft Comm Control 6.0 because this would cause errors on other computers that do not have the OCX.

Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Are you certain this is the code that is causing the problem?

If so, you may have an issue with that control. Have you tried re-registering the control, or re-installing the redistribution package for those controls?

I know it may be registered, perhaps there is a problem with it though, have you tried to unregister then register again?  regsvr32 /u to unregister
blimey, not again, lol!
Avatar of Eamon

ASKER

I have put it on 8 computers in one of our stores. I did not work on any of them. It could hardly be a problem with all 8.
I will try anyway just to make sure.

I have vb6 installed on my computer could this be why it is working on mine and not the others.

ok, I was thinking it was just one when u said another computer

Is the the same version of that ocx? you could copy yours onto there, into a different directory to win\system32 then try to register that.
Avatar of Eamon

ASKER

Tried the unregister then register again did not work.
Avatar of Eamon

ASKER

Could it be something stupid like that  MSCOMMLib.MSComm isn't MSCOMM32.OCX
Will try copying my file
You should expect the unexpected and not assume users will have it. What I have tended to do is copy all the libs I use into the local directory where app is installed then register it.
Avatar of Eamon

ASKER

They have my ocx file now and still no good
so u unregistered the existing one
then registered this newly created copy?
whats the error code, is it 429?
Avatar of Eamon

ASKER

yes 429
Avatar of Eamon

ASKER

Have just noticed in the store that when I go to add a reference to the ocx that it is not in the list (see jpg)
I had to browse to the ocx.
Is it registered correctly or is there something else I need to do.

I have another program that tries to make sure that each computer has the required files.
It does the following

FileCopy "\\server\c\epos\updates\OCX\*.*", "c:\WINDOWS\system32\*.*"
                 
Shell ("regsvr32 /s mswinsck.ocx")
Shell ("regsvr32 /s MSCOMM32.OCX")
Shell ("regsvr32 /s MSINET.OCX")
Shell ("regsvr32 /s cgPrint") ' this is my own dll


Could this be causing a problem. Also can you have the same file in two different folders registered.
What I mean is could mscomm be somewhere else on the computer and registered.
Comm.jpg
Avatar of Eamon

ASKER

I browsed to c:\windowa\system32\mscomm32.ocx and added the reference but I still get the error.

I have a a small test mdb that has the comm control on a form and tried that and that worked.
It must be just something stupid I am doing.
what is the purpose of it? kicking a cash drawer?
if so you may want to look at this :


Shell "cmd /c echo p0  > LPT1:", vbHide

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Eamon

ASKER

This is what it is used for a Customer Display.

Public Sub CustDisplayInitialize()
On Error GoTo errhandler

Dim MSComm1 As Object
Set MSComm1 = CreateObject("MSCOMMLib.MSComm")


MSComm1.CommPort = gblCustDisplayCommPort
MSComm1.Settings = "9600,N,8,1"
MSComm1.PortOpen = True
MSComm1.Output = Chr$(27) & "@"
MSComm1.Output = Chr$(13)
MSComm1.Output = Chr$(27) + "U"
MSComm1.Output = ""
MSComm1.Output = Chr$(13)
MSComm1.Output = Chr$(27) + "D"
MSComm1.Output = ""
MSComm1.PortOpen = False



Exit Sub

errhandler:
   
    MsgBox Err.Description, vbCritical, "ERROR In CustDisplayInitialize"
    MsgBox "You will not be able to use the CustomerDisplay until this problem is solved.", vbInformation, ""
    gblCustDisplayCommPort = 0


End Sub
Avatar of Eamon

ASKER

rockiroads
I have registered it manually and there is no error.
I agree with you that it must be something to do with the registering of the control.
I will take a fresh look at it on Monday.

Shell "cmd /c echo " &  Chr$(27) & "@"  &" > " & gblCustDisplayCommPort , vbHide
Shell "cmd /c echo " &  Chr$(13)  &" > " & gblCustDisplayCommPort , vbHide
Avatar of Eamon

ASKER

Surone1
Thanks but I'd rather sort the issue than try to work around it.
Also, MS has released several Security Bulletins for a LOT of ActiveX controls ... are you certain the machine where you're having troubles is up to date with all Windows/Office Service Packs? I don't see that actual control listed, but it's heavily dependent on other controls, so that may be your issue.
Avatar of Eamon

ASKER

On one of the computers in the stores I have a vb6 program installed that uses the comm control.
This program is working fine. I don't really understand how the licensing works.
Do I not have a license for the vb6 program running in the store.
Avatar of Eamon

ASKER

I mentioned previous to this that I have a access form with the control on it and this worked. So how come I have a licence for that.
try to download from here

http://activex.microsoft.com/controls/vb6/MScomm32.cab

and put both into system32 and register
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of Eamon

ASKER

Will try it wednesday. have to leave now. Thanks for the help