Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 02-05-2006, 06:22 AM
CLANDICE CLANDICE is offline
Senior Member
 
Join Date: Nov 2002
Posts: 112
Default How do I do the following

Hi All,
I'm reading from a com port but I'm not sure how to determine if I've accessed the port or still got access to the port?

Many thx in adv.
Reply With Quote
  #2  
Old 02-05-2006, 09:16 AM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: How do I do the following

While the filehandle is open it should be all yours

gLes
Reply With Quote
  #3  
Old 02-05-2006, 09:46 AM
CLANDICE CLANDICE is offline
Senior Member
 
Join Date: Nov 2002
Posts: 112
Default RE: How do I do the following

var hCommFile : THandle;

...
While hCommFile<>INVALID_HANDLE_VALUE
then do whatever code goes here.

So the above statement is what I would have to use in order to work with the com port?
Reply With Quote
  #4  
Old 02-05-2006, 11:30 AM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: How do I do the following

No actually the handle you received won't change until you do something with it, since it's just a result of the function you called to open the port. You see port opening should be just like opening a file, so until you close the handle you won't lose access to it.

gLes
Reply With Quote
  #5  
Old 02-05-2006, 11:57 AM
CLANDICE CLANDICE is offline
Senior Member
 
Join Date: Nov 2002
Posts: 112
Default RE: How do I do the following

What if the device I'm connected to get's switched off or the cable connected to it get's disconnected.
How do I check if I'm still connected before I use a writefile command to it?
Reply With Quote
Reply

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 On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:07 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.