• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 526
  • Last Modified:

Talk to Parallel Port ( QBasic to VB5 )

Does VB5 have any built-in routines to let me talk to the parallel port like QBasic?
I have the following routines I need to transform. I couldn't find any VB5 routines like this!
Should I use MSCOM ? Will it talk to Parallel Port?  It just mentioned serial, not parallel.

P.S. I'm not talking to a printer but a different device hooked to the parallel port.
Printer commands do me no good at all!




' *********************************** ReadLPT   in QBasic
Function ReadLPT()
SHARED port%  

OUT (Port% + 2), &H1
OUT (Port% + 2), &H21
For i = 1 To 10
Next i
Mybyte% = INP(Port%)
OUT (Port% + 2), 0
ReadLPT = Mybyte%

End Function

' ******************************** WriteLPT   in QBasic
Function WriteLPT(Mybyte)
SHARED port%  

OUT Port%, Mybyte
OUT Port% + 2, 1
OUT Port% + 2, 0
WritLPT = 1
End Function

0
jgore
Asked:
jgore
  • 5
  • 3
  • 2
  • +3
1 Solution
 
alamoCommented:
Nope, the 32 bit OSs keep you away from the hardware (NT completely, not sure if there's a way to do it on 95). On NT only device drivers can do what you are trying to do, but I have heard of ActiveX or DLL controls for sale which have an associated device driver and thus give you a way to interact with the hardware directly and easily (though with the proper device driver you can just open it as a file).

Sorry I don't have any precise details. If your requirements are 95-only there may be an easier workaround, too.
0
 
MAVERICKCommented:
I have seen a DLL, Written by Vincent Himpe....

I'll Find it and get back to you.....

0
 
DalinCommented:
jgore,
There is no VB built-in function, I am aware of, that let you talk to the parallel port thhat way you do in serial port.
Here are some information that tell you how to access  the parallel port.
   http://www.doc.ic.ac.uk/~ih/doc/par/
   http://www.senet.com.au/~cpeacock/parallel.htm
   http://et.nmsu.edu/~etti/fall96/computer/printer/printer.html
Hope this helps.
Regards
Dalin
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
khaledcCommented:
jgore,
I had the same problem before, the best way out of it is to use the DLL apigid32.dll included with the WIN32 API. In this DLL, you can find the following:
AgInp, and AgOut functions that have the same functionality as INP and OUT
REGARDS
0
 
jgoreAuthor Commented:
Thanks everyone, I see now I have to find a DLL to make my project work.
Also, a good place for Parallel Port code and info is:

ftp.armory.com
/pub/electronics/lpt
Win95io.zip looks promissing!


0
 
MAVERICKCommented:
Yeah, Win95io Is a easy to use DLL..... with good examples ,,,,, It was the one I used last time... only it was lost in a Harddrive Crash :)

0
 
kamallCommented:
khaledc,
I inspected the apigid32.dll and couldn't found the functions you referred to?
Are you sure they are in this DLL?

Dalin, how are you?
Hope all are Ok.
I just entered to lose 10 points and see your answer. It reminds me something.... -:))
Have a nice day.
0
 
khaledcCommented:
kamall,
I you have the Book "WIN32 API", it is on page 1455, these functions declaration are refrenced to Lib "apigdi32.dll".
I used them my self and they are working ok.
Regards
0
 
jgoreAuthor Commented:
Khaledc:

Where would I find this apigdi32.dll in Win32 api?
I have looked everywhere.

Thanks for any help......................Jerry

0
 
khaledcCommented:
jgore,
apigdi32.dll is part of WIN32 API, if you are serious about programming in VB then it is a good book and software to buy. The book name (CD is included) is : "Visual Basic Programmer's Guide to the WIN32 API" by "Daniel Appleman".
The price is around $100.00 Australian Dollars.
Another choice is to do your own ActiveX control using VC++.
Regards
0
 
kamallCommented:
khaledc,
In your previous comment, you said the DLL is 'apigid32.dll' which does not contain the functions!
In your last comment, you said it is 'apigdi32.dll'!!!
I searched 2 systems for it and couldn't find it anywhere!
Regards to all.
0
 
khaledcCommented:
kamall,
If you are trying to find the apigdi32.dll on your system then good luck if you did not buy the book.
Another dll that has similar functions is vbio32.dll, I am not sure if it is a freeware or you have to buy the license. You may be able to search the web for this dll.
Regards

0
 
kamallCommented:
khaledc,
I think that you misunderstoud my comment.
I am not trying to find the DLL on my system in order to use it, I  just wanted to know which one is the correct name for the DLL because you have confused us in referring to the DLL once as 'APIGID32.DLL' and another as 'APIGDI32.DLL' !

Regards
0
 
khaledcCommented:
kamall,
I am sorry about the confusion, it was a typing mistake. The right one is APIGDI32.DLL
Regards
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 3
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now