Results 1 to 8 of 8

Thread: Problem in Writing to a Serial Port Using Mscomm32.ocx control

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2010
    Posts
    28

    Problem in Writing to a Serial Port Using Mscomm32.ocx control

    Hi,

    In my windows application I am using Mscomm32.ocx control for serial communication.

    I set the control properties like below in the Form1_Load event.

    AxMSComm1.CommPort = 1
    AxMSComm1.Settings = "9600,N,8,1"
    AxMSComm1.InputLen = 0
    AxMSComm1.PortOpen = True
    AxMSComm1.SThreshhold=1
    AxMSComm1.RThreshhold=1

    I did the same way as mentioned in the following link.

    http://support.microsoft.com/kb/139526/en-us

    But I am getting the following error when I try to write data to a serial port using output method.

    AxMSComm1.Output {"Exception from HRESULT: 0x800A018A (CTL_E_GETNOTSUPPORTED)"} Object

    Please tell me why I am getting this error and how to resolve this???

    Thanks in advance.

  2. #2
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Problem in Writing to a Serial Port Using Mscomm32.ocx control

    Is there a reason you are not using the .Net SerialPort?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2010
    Posts
    28

    Re: Problem in Writing to a Serial Port Using Mscomm32.ocx control

    Hi,
    I developed a application for serial communication using that control.
    I saw in so many websites where ever serial communication happend using this control they did in the same way.

    I just want to know why I am getting that error????

    Thanks for your reply.

  4. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Problem in Writing to a Serial Port Using Mscomm32.ocx control

    You may have better luck getting an answer in the VB6 forum. The is .Net and .Net has a SerialPort Class that I assume is a replacement for MSComm.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  5. #5
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Problem in Writing to a Serial Port Using Mscomm32.ocx control

    The link you posted is for FoxPro.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jun 2010
    Posts
    28

    Re: Problem in Writing to a Serial Port Using Mscomm32.ocx control

    Hi,

    in some other link also we can see the same thing.

    http://msdn.microsoft.com/en-us/libr...8VS.60%29.aspx

    my intension is writing data to a output buffer.

  7. #7
    Fanatic Member
    Join Date
    Sep 2009
    Location
    Lakewood, Colorado
    Posts
    621

    Re: Problem in Writing to a Serial Port Using Mscomm32.ocx control

    Do you have VB6 installed on the same machine? If not, there may be a licensing issue (MSComm32.ocx is licensed to work with VB6). You can download NETComm.ocx, free, from my homepage -- www.hardandsoftware.net. It is licensed for any environment that supports ActiveX controls, and was originally developed for .NET.

    Porting your code to use the built-in SerialPort object is the best move. Such a port shouldn't take more than an hour or so, even for a program that has a lot of serial port reads and writes. I'd really suggest that you go that route. I have a Terminal example on the same Software Downloads page that illustrates its use.

    Dick
    Richard Grier, Consultant, Hard & Software
    Microsoft MVP (Visual Basic)

  8. #8
    Addicted Member
    Join Date
    Mar 2010
    Location
    Southeast Michigan
    Posts
    155

    Re: Problem in Writing to a Serial Port Using Mscomm32.ocx control

    I read in one post with the same error that there was a problem with the port settings. They didn't post the changes that were made to correct it so not sure how much help that would be to you. May be worth taking a look at however.
    Dave

    Helpful information I've found here so far : The Definitive "Passing Data Between Forms" : Restrict TextBox to only certain characters, numeric or symbolic :
    .NET Regex Syntax (scripting) : .NET Regex Language Element : .NET Regex Class : Regular-Expressions.info
    Stuff I've learned here so far : Bing and Google are your friend. Trying to help others solve their problems is a great learning experience

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width