Solved

Talk to Parallel Port ( QBasic to VB5 )

Posted on 1998-07-13
14
485 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

785 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