Article View: borland.public.cppbuilder.nativeapi
Article #12462Re: Detecting LPT port address
From: Vladimir Afanasyev
Date: Thu, 04 Dec 2003 17:21
Date: Thu, 04 Dec 2003 17:21
34 lines
1713 bytes
1713 bytes
Hi Moshe,
"Moshe Shahar" <msachar@tiogatech.com> wrote:
>
>More questions :
>Do the LPT work in rates like COM ?
I think no.
Serial port has hardware port (offset 0) to set rates but
parallel hasn't.
>How can I know that the LPT port in not used by other app ?
You can use CreateFile function for open...
DWORD err=0;
HANDLE hLPT=CreateFile("LPT1",GENERIC_WRITE | GENERIC_READ,0,NULL,
OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if(hLPT == INVALID_HANDLE_VALUE)
err=GetLastError();
else CloseHandle(hLPT);
if(err == ERROR_ACCESS_DENIED)
{
ShowMessage("Device unavailable - no access");
return;
}
if(err != 0)ShowMessage("Another error");
else ShowMessage("Yes !!!")
Vladimir.
Technical Details
Message-ID:
<3fcf7b2f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3fcc8afe$1@newsgroups.borland.com> <3fcca348$1@newsgroups.borland.com> <3fcf2f89$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,7c1a925bc86d06a9 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-12-04 10:40:37 PST From: "Vladimir Afanasyev" <avv@systema.kiev.ua> Sender: "Vladimir Afanasyev" <avv@systema.kiev.ua> Reply-To: "Vladimir Afanasyev" <avv@systema.kiev.ua> Subject: Re: Detecting LPT port address Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 212.82.216.226 X-Forwarded-For: 192.168.0.147 References: <3fcc8afe$1@newsgroups.borland.com> <3fcca348$1@newsgroups.borland.com> <3fcf2f89$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <3fcf7b2f$1@newsgroups.borland.com> Date: 4 Dec 2003 10:21:35 -0700 X-Trace: newsgroups.borland.com 1070562095 207.105.83.66 (4 Dec 2003 10:21:35 -0700) Lines: 34 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail