Solved

Talk to Parallel Port ( QBasic to VB5 )

Posted on 1998-07-13
14
473 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now