MSCOMM control
MSCOMM control
MSCOMM control
MSCOMM control
MSCOMM control
MSCOMM control MSCOMM control MSCOMM control MSCOMM control MSCOMM control MSCOMM control MSCOMM control MSCOMM control
MSCOMM control MSCOMM control
MSCOMM control
Go Back  Xtreme Visual Basic Talk > > > MSCOMM control


Reply
 
Thread Tools Display Modes
  #1  
Old 09-05-2001, 06:52 PM
giang
Guest
 
Posts: n/a
Question MSCOMM control


Dear All, this is my exam code :

Private Sub MSComm1_OnComm()
Dim sData As String ' Holds our incoming data
If MSComm1.CommEvent = comEvReceive Then
sData = MSComm1.Input
sData = Mid(sData, 5, 8) 'get 5 bytes from data received
lstReceive.AddItem (sData)
ElseIf MSComm1.CommEvent = comEvBreak Then
lstReceive.AddItem ("Break Event")
End If
End Sub

And I receive Break Even more than Receive Event

Thanks for your reply !!!

Thanks very much

<P ID="edit"><FONT class="small"><EM>Edited by giang on 09/05/01 07:59 PM.</EM></FONT></P>
Reply With Quote
  #2  
Old 09-05-2001, 07:06 PM
BillSoo's Avatar
BillSooMSCOMM control BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default Re: MSCOMM control

I'm not exactly sure what you are asking....

It sounds like you need to receive the bytes in the ONCOMM event....



"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
  #3  
Old 09-05-2001, 07:22 PM
JaredMSCOMM control Jared is offline
Centurion

Retired Moderator
* Guru *
 
Join Date: Oct 2000
Location: Ohio
Posts: 176
Default Re: MSCOMM control

There are two main methods of receiving serial data using the MSComm control. You can either use the OnComm event, or you can poll the buffer by using timer.

Check out the articles I have written at:
http://vboverdrive.extreme-vb.net/articles.php3

If you have any more questions, feel free to ask...


Jared Hoylman
VB Overdrive
http://vboverdrive.extreme-vb.net/main.php3
__________________
Jared
Reply With Quote
  #4  
Old 09-05-2001, 07:25 PM
basdewaard's Avatar
basdewaard basdewaard is offline
Centurion
 
Join Date: Jul 2001
Location: Perth, Western Australia
Posts: 174
Default Re: MSCOMM control

i'm working with the mscomm control at the moment. i've attached a file that 'may' help. it contains a list of possible errors in which you can add your own error handling code (it's from the MSDN library).

why don't you post a copy of your code?


<font color=blue> :: grin-r :: </font color=blue>
Reply With Quote
  #5  
Old 09-05-2001, 09:56 PM
basdewaard's Avatar
basdewaard basdewaard is offline
Centurion
 
Join Date: Jul 2001
Location: Perth, Western Australia
Posts: 174
Default Re: MSCOMM control

grrrr. this is starting to look like the impossible...

i'm using two bits of proprietry software: 1 dials a phone number and establishes a connection, the other then takes over the port scanning processes and runs a DDE.

i'm trying to replace the program that dials the phone number (it isn't flexible enough). i've used the mscomm control to establish a connection......no problems there. where i'm struggling is when i try to run the second program (that runs the DDE), it comes back with an error "com port already in use" - fair enough!

the big question is: "how do i hand over the com port to another application by using the mscomm control???". closing the port is no good because it hangs up the connection.




<font color=blue> :: grin-r :: </font color=blue>
Reply With Quote
  #6  
Old 09-05-2001, 11:45 PM
BillSoo's Avatar
BillSooMSCOMM control BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default Re: MSCOMM control

I'm not sure....but there may be a way to configure your modem such that closing the port doesn't hang up the line. If so, you could open the port, dial, close the port. Run the other app which opens the port and connects to the already connected line. Check your modem manual for the Hayes AT commands...


"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
  #7  
Old 09-07-2001, 07:38 PM
basdewaard's Avatar
basdewaard basdewaard is offline
Centurion
 
Join Date: Jul 2001
Location: Perth, Western Australia
Posts: 174
Default Re: MSCOMM control

thanks for the suggestion BillSoo. i haven't had any luck though! i spent all day at work yesterday stuffing around with this one. i even asked our 'communications expert' who told me it wasn't possible to send that sort of AT commands to the modem.

has *anyone* got any other suggestions? i'm thinking of maybe using an alternative to mscomm but i'm far from experienced in this area.


<font color=blue> :: grin-r :: </font color=blue>
Reply With Quote
  #8  
Old 09-07-2001, 07:55 PM
Derek Stone
Guest
 
Posts: n/a
Default Re: MSCOMM control

The last time I saw a "port handoff" was a long time ago... and it used a nasty vitual driver that was far from friendly.
I'd investigate into other, more advanced, comm controls, as you had suggested.
I doubt however there is an easy answer to this one.

Good Luck
-cl

Reply With Quote
  #9  
Old 09-08-2001, 02:53 AM
basdewaard's Avatar
basdewaard basdewaard is offline
Centurion
 
Join Date: Jul 2001
Location: Perth, Western Australia
Posts: 174
Exclamation Re: MSCOMM control

thanks cl. that's just boosted my motivation to nail this one [img]images/icons/smile.gif[/img]


<font color=blue> :: grin-r :: </font color=blue>
Reply With Quote
  #10  
Old 09-09-2001, 02:28 AM
JaredMSCOMM control Jared is offline
Centurion

Retired Moderator
* Guru *
 
Join Date: Oct 2000
Location: Ohio
Posts: 176
Default Re: MSCOMM control

In the code you showed, you used the Constant "comEvBreak" This constant does not exsist, but "comEventBreak" does.

comEventBreak = 1001

If you are not using "Option Explicit" at the top of your modules then "comEvBreak" will be defined as a variant variable with the value of zero by default.

So maybe when the OnComm event fires with whatever event has the value of zero, you are thinking you are getting a "Break" signal....

Hopefully this will solve your problem...


Jared Hoylman
VB Overdrive
http://vboverdrive.extreme-vb.net/main.php3
__________________
Jared
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
MSCOMM control
MSCOMM control
MSCOMM control MSCOMM control
MSCOMM control
MSCOMM control
MSCOMM control MSCOMM control MSCOMM control MSCOMM control MSCOMM control MSCOMM control MSCOMM control
MSCOMM control
MSCOMM control
 
MSCOMM control
MSCOMM control
 
-->