-
January 20th, 2006, 01:29 PM
#1
write data on LPT Port using win32
hi,
i want to write data on printer port ,have any cammand that do that.
the data may be 0 or 1
Thanx
-
January 20th, 2006, 01:46 PM
#2
Re: write data on LPT Port using win32
Use CreateFile to open your LPT device as described under communication resources. Instead of "COM1" just open "LPT1". If you have any further questions, feel free to ask again.
-
January 21st, 2006, 04:43 AM
#3
Re: write data on LPT Port using win32
Does CreateFile work with NT,2000,XP?
-
January 21st, 2006, 08:20 AM
#4
Re: write data on LPT Port using win32
Originally Posted by eeboy
Does CreateFile work with NT,2000,XP?
yep it does
regards
sreehari
-
January 21st, 2006, 09:07 AM
#5
Re: write data on LPT Port using win32
Originally Posted by eeboy
Does CreateFile work with NT,2000,XP?
To know what operating systems are supported by an api, look under the Requirements section of that api in MSDN.
CreateFile
-
January 21st, 2006, 01:02 PM
#6
Re: write data on LPT Port using win32
Actually i want to write bit on printer port pin.i has been done it in delphi,if we write 1 on a pin then it show high voltage and 0 for low,i just need a simple code that how i can write
data in a printer port on any PIN,
In simple C we use
outportb(port NO,value); can it work for my this problem in vc++.
I m using XP and Tool VC++ 6.0
-
January 21st, 2006, 01:10 PM
#7
Re: write data on LPT Port using win32
Originally Posted by kku
can it work for my this problem in vc++.
Your question is not clear you have been told above how to do it, you can also look at this article: Using standard printing from windows
please be more specific.
Cheers
-
January 21st, 2006, 05:33 PM
#8
Re: write data on LPT Port using win32
I know CreateFile will work under NT,2000,XP but if you try to obtain a handle and access the port don't you generate an exception? It's been a while but as I recall you get a priviliged instruction exception. Not true?
-
January 22nd, 2006, 03:12 AM
#9
Re: write data on LPT Port using win32
Originally Posted by eeboy
I know CreateFile will work under NT,2000,XP but if you try to obtain a handle and access the port don't you generate an exception? It's been a while but as I recall you get a priviliged instruction exception. Not true?
First ::CreateFile(..) will work in win95 and higher you can refer to msdn for more info, look at leojose post.
Now to your question about exception, why do you think you will get exception if you try open that port via ::CreateFile(..) ?
Did you try it and get exception? You should check the handle you get and if its INVALID_HANDLE_VALUE you can use ::GetLastError() for more info about the failure.
Cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|