Solved

Talk to Parallel Port ( QBasic to VB5 )

Posted on 1998-07-13
14
496 Views
Last Modified: 2012-08-13
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
Comment
Question by:jgore
  • 5
  • 3
  • 2
  • +3
14 Comments
 
LVL 6

Expert Comment

by:alamo
ID: 1465651
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
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1465652
I have seen a DLL, Written by Vincent Himpe....

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

0
 
LVL 9

Accepted Solution

by:
Dalin earned 100 total points
ID: 1465653
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:khaledc
ID: 1465654
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
 

Author Comment

by:jgore
ID: 1465655
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
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1465656
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
 
LVL 7

Expert Comment

by:kamall
ID: 1465657
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
 
LVL 1

Expert Comment

by:khaledc
ID: 1465658
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
 

Author Comment

by:jgore
ID: 1465659
Khaledc:

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

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

0
 
LVL 1

Expert Comment

by:khaledc
ID: 1465660
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
 
LVL 7

Expert Comment

by:kamall
ID: 1465661
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
 
LVL 1

Expert Comment

by:khaledc
ID: 1465662
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
 
LVL 7

Expert Comment

by:kamall
ID: 1465663
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
 
LVL 1

Expert Comment

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question