Solved

Talk to Parallel Port ( QBasic to VB5 )

Posted on 1998-07-13
14
479 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
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…

863 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

25 Experts available now in Live!

Get 1:1 Help Now