CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503

    Accessing COM port

    Hi there!
    I am working on a service that sends/ receives SMS using GSM/GPRS modem which is attached to COM port.
    I cannot get to connect with the PORT...
    Does anyone has any idea how to work it out?
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

  2. #2
    Join Date
    Dec 2000
    Location
    Slovakia
    Posts
    1,043
    What is the GetLastError() returned code?

  3. #3
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    are you seting the baud rate and initialization parameters properly.

    -Paresh
    - Software Architect

  4. #4
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503

    here is what I am doing!

    well, here it is not giving me any errors...
    It simply writes port opened Successfully.

    now, I am trying to catch any event so, I did DLL import of SetCommMask and WaitCommEvent...

    and now it is not catching any event...
    as it is a modem, I think I need to send a modem command like
    "AT+CMGL=" and should see its result... that'swhat I am doing at the moment...

    and when we talk about setting port parametrs, the winapi function needs a DCB structure... hola! I dont really get to know how to pass this structure through C#...

    I think C++ was a better way out, but i opt for C#... hope wont have to go back to C++ for writing this service... :-)

    thank you folkz for answers... if you have any idea, will be nice to hear...
    Last edited by Andy Tacker; April 24th, 2003 at 08:55 AM.
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

  5. #5
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503

    Accessing COM Port solution

    Here! I atlast, got to find the solution to this problem.
    I hope some other person will be looking for answers to same question... so, here is the link to get some idea about how to do this....

    AccessingCOMPorts.html
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

  6. #6
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    first of all nice picture of yours

    actually, you can do much in VC++ directly. but in C# you have to make use of APIs.

    I remember , I did that AT + commands in past. it was a good fun to retrive results.

    unfortunately I don't have the code snippet right now. but

    I would point you an example,

    SerialStream

    Which is very known example and you can do stuffs like

    read buffer,
    write buffer,
    open ports etc.
    In fact you can send all of the AT+CMGL and all commands.

    hope this helps though,
    Paresh
    - Software Architect

  7. #7
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503
    Yes Paresh!

    I had been working in C++ for quite a long time. but lately, the people here in company started to think about using latst .NET Technology.

    As far as my personal opinion, it would have been fun and quite an easy job to MOULD this pretty good project in C++.

    Anyways, thanks for replies and the link.
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

  8. #8
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    yeah ! Everywhere I see is Just .NET nothing else.
    - Software Architect

  9. #9
    Join Date
    Jun 2003
    Posts
    1

    vc++ code for accesing COM port

    Hi,
    I will be greatful if I can get the VC++ code for communicating with GSM modem as soon as possible.It is urgent. Thanks in advance.

  10. #10
    Join Date
    Jun 2003
    Location
    Malaysia
    Posts
    9

    Re: vc++ code for accesing COM port

    Originally posted by Anil Belankar
    Hi,
    I will be greatful if I can get the VC++ code for communicating with GSM modem as soon as possible.It is urgent. Thanks in advance.
    -> What port(Com/USB etc) do you use?

  11. #11
    Join Date
    Aug 2004
    Posts
    12

    Re: Accessing COM port

    -> What port(Com/USB etc) do you use?
    USB please ...

  12. #12
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Accessing COM port

    Do you want fries with that ?

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

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

Featured