Link to home
Start Free TrialLog in
Avatar of liung012
liung012

asked on

create an ActiveXEXE to get input from a device through serial comm?

Hi, i wanna create an activeXEXE to get input from a device through serial comm port?
I mean,I'll be always to fact serial comm programmin. get data from same device. So, i don't need to write again the coding for that. you may be ask "why do you have to crate an activeXEXE? why not an activeXDLL?"
that answer is because my application (main application) has a routine task on every second. that it'll not disturb the routine.
actually, i have created what i excatly wanted, but i couldn't fire my event in the mssomm1_event (recieve event). it could open/close port, just couldn't get input from device.

oh ya, I have PCI communication Port installed to my computer (Port 5 and 6). but when i scanned using mscomm i just got 2 default comm port (1 and 2). My pci comm port is RS485.
does mscomm has limited to 4 ports (1,2,3,4) ?

Please help me to solve this problem..

thanks..

Liung012
Avatar of eamonk
eamonk

Hi,
The mscomm control supports comm ports 1 up to 16.

You could try calling:
Setting the MS Comm Control CommPort Property to 4 (and next 5).
Call the PortOpen method of the MS Comm Control.
If the PortOpen is True then MSComm can access the Port, if false there is a problem.

I have included some sample code:

For i = 0 To 6
        MSComm1.CommPort = i
        MSComm1.PortOpen = True
       
        If Not MSComm1.PortOpen Then
            str = "Comm Port " & i & " is unavailable."
            lstUnavailable.AddItem str
            lstUnavailable.AddItem Err.Description
        Else
            str = "Comm Port " & i & " is available."
            lstAvailable.AddItem str
        End If
        Me.Refresh
        Err.Clear
        MSComm1.PortOpen = False
 Next i

EamonK.
   
liung012:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
Avatar of DanRollins
liung012, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Save as PAQ -- No Refund.

DanRollins -- EE database cleanup volunteer
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial