VS 2010 [RESOLVED] Writing to parallel port - Windows 7 64-bit-VBForums
Results 1 to 28 of 28

Thread: [RESOLVED] Writing to parallel port - Windows 7 64-bit

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Resolved [RESOLVED] Writing to parallel port - Windows 7 64-bit

    Does anyone have experience writing data to the parallel port (printer port) in Windows 7 64-bit. I have been trying inpout32.dll, inpoutx64.dll and following all the info on http://www.highrez.co.uk/ and www.logix4u.net but can't get anything to work. I have an on-board parallel port at &H378 - not an add-on card - and have tried various modes in the BIOS (standard, ECP etc). I have a background in electronics so I am confident my testing methods are sound; I just cannot get a data bit to change state under program control. I need to send data to an 8-bit port on some 20th Century electronics so serial/USB interfaces are not really an option. There must be a way to control those 8 data bits in Windows 7, mustn't there?

    Thanks in advance.

  2. #2
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    739

    Re: Writing to parallel port - Windows 7 64-bit

    Windows is supposed to be a "protected operating system" which means that no process running at the application layer is (supposed to be) allowed to 'talk' directly to hardware. Only processes at the driver layer are allowed to do that.

    I said "Supposed to be" because Windows9x was not strict about that and I believe even the inpout dlls appeared to work ok with w2000 and XP. But maybe Windows 7 finally closed that door.

    Have you tried simply copying data to the 'file' called LPT1.
    Last edited by IanS; Mar 11th, 2011 at 02:24 PM.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: Writing to parallel port - Windows 7 64-bit

    Quote Originally Posted by IanS View Post
    Windows is supposed to be a "protected operating system" which means that no process running at the application layer is allowed to 'talk' directly to hardware. Only processes at the driver layer are allowed to do that.

    However, Windows9x was not strict about that and I believe even the inpout dlls appeared to work ok with windows XP. But maybe Windows7 finally closed the door.

    Have you tried simply copying data to the 'file' called LPT1
    Thanks for your reply. How do you copy data to LPT1?

    EDIT: Guess you mean something like copy test.txt lpt1 at a command prompt? I guess it could work once I connect the device and the handshaking lines. Difficult to set up the hardware for test purposes though.
    Last edited by paulg4ije; Mar 11th, 2011 at 02:34 PM.

  4. #4
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    739

    Re: Writing to parallel port - Windows 7 64-bit

    Deep down in the operating system there are files called LPT1, LPT2, Com1, Com2 etc.

    You can read and write to those 'files' exactly the same as you would read and write to any text file except that if you write data to a file called LPT1 then that data gets pushed out of IO port 378 (The parallel port). If you write to a file called LPT2 then the data goes out through 278

  5. #5
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    739

    Re: Writing to parallel port - Windows 7 64-bit

    I haven't tested this so please check the syntax but something like this 'might' work


    Code:
    Dim FILE_NAME As String = "LPT1"
    
    If System.IO.File.Exists(FILE_NAME) = True Then
    Dim objWriter As New System.IO.StreamWriter(FILE_NAME)
    objWriter.Write("SOME TEXT")
    objWriter.Close()
    MsgBox("Text written to port")
    Else
    MsgBox("Port Does Not Exist")
    End If

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: Writing to parallel port - Windows 7 64-bit

    Thanks Ian. I think there is some chance this could work, as I am effectively transferring a file and not looking to access individual data bits. I will have to make up a cable and test it when I next have access to the old hardware.
    Last edited by paulg4ije; Mar 11th, 2011 at 02:46 PM.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: Writing to parallel port - Windows 7 64-bit

    I actually missed your last reply when I posed my last response. I get "Port does not exist" with your code but I will investigate this idea further.

    Thanks for your help.
    Last edited by paulg4ije; Mar 12th, 2011 at 02:29 AM.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: Writing to parallel port - Windows 7 64-bit

    I will leave this thread open in case there are more suggestions. If the simple file copy to LPT1 works, I will then want to move to the second stage, which is reading data INTO the parallel port.

    Thanks.

  9. #9
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    739

    Re: Writing to parallel port - Windows 7 64-bit

    Quote Originally Posted by paulg4ije View Post
    I will leave this thread open in case there are more suggestions. If the simple file copy to LPT1 works, I will then want to move to the second stage, which is reading data INTO the parallel port.

    Thanks.
    Take a look in device manager in the section "Ports Com&LPT". Do you have an entry for LPT1 ?

    Because it's PCI it might be registered under a different port number. If LPT(n) exists in device manager then it's a kind of virtual file that you can write to. If it's a bi-directional port then you can also read from it just as if it was a file.

    But maybe Windows7 has added some feature to stop us doing that kind of thing. : o (
    Last edited by IanS; Mar 12th, 2011 at 09:18 AM.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: Writing to parallel port - Windows 7 64-bit

    I have Printer Port (LPT1) listed in Device Manager as expected. The address is &H378.
    As you say, Windows 7 may have stopped us accessing the port. I have no trouble using inpout32.dll on a Windows XP machine.

  11. #11
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    739

    Re: Writing to parallel port - Windows 7 64-bit

    Just out of interest try to create a file on your desktop called LPT1

    It shouldn't let you do that because LPT1 is a reserved name. It's a system filename that basically points pointing to the port.

    If your Win7 machine allows you to create such a file then it indicates that LPT is not system wide as it was on 9x - XP. Maybe it's owned by the system and only exists in that 'users' space which is why you get the file not found message.

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: Writing to parallel port - Windows 7 64-bit

    I get "This filename is reserved for use by Windows".

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: Writing to parallel port - Windows 7 64-bit

    I finally got inpoutx64.dll working. My fault it took so long; I should learn to read the instructions

    In case anyone else needs to write to their parallel port under Windows 7 64-bit, here's what you do:

    Go to http://www.highrez.co.uk/downloads/inpout32/default.htm scroll down the page and click on the Binaries only - x86 & x64 DLLs and libs link. This will download InpOutBinaries_1500.zip. Once downloaded, unzip and go to the Win32 folder and double-click on InstallDriver.exe. You will get a UAC message asking if you want to allow the program to make changes. Answer Yes at your own risk ...

    There is also a VB.NET test program on the highrez downloads page. Click on .NET 2.0 (2005) Example code to download it. It works fine in VB.NET 2010 Express.

    To use the dll in your own programs, copy inpoutx64.dll into your debug folder. You will obviously need to distribute the dll with any published package you produce.

  14. #14
    New Member
    Join Date
    Apr 2011
    Posts
    1

    Re: Writing to parallel port - Windows 7 64-bit

    Quote Originally Posted by paulg4ije View Post
    I finally got inpoutx64.dll working. My fault it took so long; I should learn to read the instructions

    In case anyone else needs to write to their parallel port under Windows 7 64-bit, here's what you do:

    Go to http://www.highrez.co.uk/downloads/inpout32/default.htm scroll down the page and click on the Binaries only - x86 & x64 DLLs and libs link. This will download InpOutBinaries_1500.zip. Once downloaded, unzip and go to the Win32 folder and double-click on InstallDriver.exe. You will get a UAC message asking if you want to allow the program to make changes. Answer Yes at your own risk ...

    There is also a VB.NET test program on the highrez downloads page. Click on .NET 2.0 (2005) Example code to download it. It works fine in VB.NET 2010 Express.

    To use the dll in your own programs, copy inpoutx64.dll into your debug folder. You will obviously need to distribute the dll with any published package you produce.

    Hi paulg4ije, I could not run inpoutx64.dll could explain and give an example of its use?
    I need to write to the parallel port under windows 7 x64
    Thanks!

  15. #15

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: Writing to parallel port - Windows 7 64-bit

    Quote Originally Posted by soylachocha View Post
    Hi paulg4ije, I could not run inpoutx64.dll could explain and give an example of its use?
    I need to write to the parallel port under windows 7 x64
    Thanks!
    My previous post describes the procedure quite well I think. Have you installed the driver as I said? Did you get an error when you clicked on "Installdriver.exe"? You must do this first or the DLL will not work. You must then put a copy of inpoutx64.dll in the \bin\x64\debug folder of your project, and distribute the dll with your installation package.
    Last edited by paulg4ije; Apr 18th, 2011 at 02:33 AM.

  16. #16
    New Member
    Join Date
    Jul 2012
    Posts
    2

    Smile Re: [RESOLVED] Writing to parallel port - Windows 7 64-bit

    Hello,

    I'm searching solution for this case - I have an application written in C and compiled with Labwindows/CVI, to communicate with parallel port;

    it operates properly in 32bit, but in Win7 64 bit it cannot read/write via parallel port

    I tried to follow all the instructions with inpoutx64.dll, but still it does not operate, maybe I'have missed smth?

    best regards,
    Armand

  17. #17

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: [RESOLVED] Writing to parallel port - Windows 7 64-bit

    Quote Originally Posted by armand2010 View Post
    Hello,

    I'm searching solution for this case - I have an application written in C and compiled with Labwindows/CVI, to communicate with parallel port;

    it operates properly in 32bit, but in Win7 64 bit it cannot read/write via parallel port

    I tried to follow all the instructions with inpoutx64.dll, but still it does not operate, maybe I'have missed smth?

    best regards,
    Armand
    I don't know what else I can add really. You must follow the installation procedure exactly as I described it. Just copying the 64-bit DLL into your project will not work. The 32-bit DLL does work just by copying, but not the 64-bit version. Have you tried the .NET example code? Even if you don't normally use VB.NET or C# you could install one of those platforms just to prove the DLL is installed correctly. The example code works fine in VB.NET 2010 Express. I haven't tried C#.

    Good luck!

  18. #18
    New Member
    Join Date
    Jul 2012
    Posts
    2

    Re: [RESOLVED] Writing to parallel port - Windows 7 64-bit

    Thanks,

    I'll try the .NET example code, I've not done it previously

    Good luck!

  19. #19
    New Member
    Join Date
    Aug 2012
    Posts
    1

    Re: [RESOLVED] Writing to parallel port - Windows 7 64-bit

    thanks a lot guys, thnks a lot paulg, thanks a lot highrez.co.uk... there is different world for who know english, if i do that with %10 english

  20. #20
    New Member
    Join Date
    Sep 2012
    Posts
    4

    Re: Writing to parallel port - Windows 7 64-bit

    Hi paul4ije,
    At first, thanks for your post.i can write to parallel port in win7 64 bits by using the way that you posted. But is it got the other way for us to read the data port?
    Cause what i have done is just writing the 8bits data and "output" to data port, once i want to read from external circuit through data port, it always show "4" in decimal.
    i am using Visual Basic 2008 and use the out() and inp() commands to access the data port. Anyone got idea about this?
    Quote Originally Posted by paulg4ije View Post
    I finally got inpoutx64.dll working. My fault it took so long; I should learn to read the instructions

    In case anyone else needs to write to their parallel port under Windows 7 64-bit, here's what you do:

    Go to http://www.highrez.co.uk/downloads/inpout32/default.htm scroll down the page and click on the Binaries only - x86 & x64 DLLs and libs link. This will download InpOutBinaries_1500.zip. Once downloaded, unzip and go to the Win32 folder and double-click on InstallDriver.exe. You will get a UAC message asking if you want to allow the program to make changes. Answer Yes at your own risk ...

    There is also a VB.NET test program on the highrez downloads page. Click on .NET 2.0 (2005) Example code to download it. It works fine in VB.NET 2010 Express.

    To use the dll in your own programs, copy inpoutx64.dll into your debug folder. You will obviously need to distribute the dll with any published package you produce.

  21. #21

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: Writing to parallel port - Windows 7 64-bit

    Quote Originally Posted by ktwei View Post
    Hi paul4ije,
    At first, thanks for your post.i can write to parallel port in win7 64 bits by using the way that you posted. But is it got the other way for us to read the data port?
    Cause what i have done is just writing the 8bits data and "output" to data port, once i want to read from external circuit through data port, it always show "4" in decimal.
    i am using Visual Basic 2008 and use the out() and inp() commands to access the data port. Anyone got idea about this?
    I will check my code later and try to help you. I am just off to work now. My program uses reading from the port (input) just as much as output and it works very well.

    EDIT: Just one quick thought: you need to set the data direction to input by setting bit 5 of the Control Port (890 or &37A in Hex) to logic 1 - something like Out64(890, 32).
    Last edited by paulg4ije; Sep 19th, 2012 at 02:48 AM.

  22. #22
    New Member
    Join Date
    Sep 2012
    Posts
    4

    Re: Writing to parallel port - Windows 7 64-bit

    Quote Originally Posted by paulg4ije View Post
    I will check my code later and try to help you. I am just off to work now. My program uses reading from the port (input) just as much as output and it works very well.

    EDIT: Just one quick thought: you need to set the data direction to input by setting bit 5 of the Control Port (890 or &37A in Hex) to logic 1 - something like Out64(890, 32).
    i have solved the problem by changing the parallel port mode from SPP to EPP mode in win7 64bit. it works well. but i have try my code in winxp, it works well in SPP mode also.

  23. #23

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: [RESOLVED] Writing to parallel port - Windows 7 64-bit

    Glad to hear you got it working

  24. #24
    New Member
    Join Date
    Sep 2012
    Posts
    4

    Re: [RESOLVED] Writing to parallel port - Windows 7 64-bit

    [QUOTE=paulg4ije;4241309]Glad to hear you got it working [/Q
    anyway, thank for ur help again.

  25. #25
    New Member
    Join Date
    Jul 2014
    Location
    uk
    Posts
    2

    Re: Writing to parallel port - Windows 7 64-bit

    Quote Originally Posted by paulg4ije View Post
    I finally got inpoutx64.dll working. My fault it took so long; I should learn to read the instructions

    In case anyone else needs to write to their parallel port under Windows 7 64-bit, here's what you do:

    Go to http://www.highrez.co.uk/downloads/inpout32/default.htm scroll down the page and click on the Binaries only - x86 & x64 DLLs and libs link. This will download InpOutBinaries_1500.zip. Once downloaded, unzip and go to the Win32 folder and double-click on InstallDriver.exe. You will get a UAC message asking if you want to allow the program to make changes. Answer Yes at your own risk ...

    There is also a VB.NET test program on the highrez downloads page. Click on .NET 2.0 (2005) Example code to download it. It works fine in VB.NET 2010 Express.

    To use the dll in your own programs, copy inpoutx64.dll into your debug folder. You will obviously need to distribute the dll with any published package you produce.
    Do you know if something like this would work with Win7 32bit? I'm using VB6. the old inpout32.dll doesn't seem to work.
    Thanks, ahab.

  26. #26

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: Writing to parallel port - Windows 7 64-bit

    Quote Originally Posted by ahab View Post
    Do you know if something like this would work with Win7 32bit? I'm using VB6. the old inpout32.dll doesn't seem to work.
    Thanks, ahab.
    I have only used the 64-bit version so I don't think I can be of any help. If I needed to use 32-bit I would just look at the documentation on the highrez.co.uk website.

    Good luck with your project.

    EDIT: Hmmm ... re-reading my posts it seems I must have used the 32-bit DLL but I don't remember doing anything special to make it work. I guess I just copied inpout32.dll into my project folder. Again, good luck!
    Last edited by paulg4ije; Jul 17th, 2014 at 01:01 PM.

  27. #27
    Banned
    Join Date
    Jul 2014
    Posts
    221

    Re: [RESOLVED] Writing to parallel port - Windows 7 64-bit

    Lol this is a really old and popular thread.

  28. #28

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    408

    Re: [RESOLVED] Writing to parallel port - Windows 7 64-bit

    Indeed; old and popular - just like me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.