inpout32.dll (1.5.0.1) win7 and QB64 works with issues

My x64 port of InpOut32
danube
New User
Posts: 7
Joined: Thu Mar 03, 2016 11:12 pm

inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by danube » Fri Mar 04, 2016 5:49 pm

Hi Phil,

First of all THANK YOU for this incredibly useful update to InpOut32. I am attempting to use QB64 (v 1.00) on a Window 7 machine with an on-board COM port (i.e. hardware port, not a USB adapter) to talk to a voltmeter via serial port. I am having trouble opening the port.

I have installed the 32 bit inpout32.dll from the 1501.zip package using InstallDriver.exe. I have confirmed that c:\windows\system32\drivers\inpoutx64.sys was installed. I am using the code described on the QB64 wiki here: qb64 dot net /wiki/index.php/Port_Access_Libraries to open the COM port by sending bit-level commands to the UART ports as shown in the code immediataly under "COM Ports" halfway down the page.

And, everything works, BUT ONLY after I have loaded the free serial port test program here: microridge dot com /comtestserial.htm With that test program I can send characters to the COM port and change it's state manually. If I run my QB64 program concurrently, I can do the same. As soon as I shut down the test program, I can no longer do anything with the COM port from Basic.

I also wrote the code attached below to continuously query the UART registers of COM1. It seems to work fine, returning the values of the bytes associated with the COM port, but again, only when the serial test port program is running. Once I stop that test program, the values returned by my QB64 program are all 255, i.e. it doesn't seem to be able to read the port.

SO, do you have any suggestions as to what is going on and how to fix it? I would prefer not to have to run external programs to enable by QB64 code to run.

Thanks for your help and advice.

Dan

----------------------------------------------------------------------------------------------------------
REM COMRegisterScan.bas: Scan registers associated with open COM
REM port continously, to spot changes.

DECLARE DYNAMIC LIBRARY "inpout32"
FUNCTION Inp32% (BYVAL PortAddress AS INTEGER)
SUB Out32 (BYVAL PortAddress AS INTEGER, BYVAL Value AS INTEGER)
END DECLARE

Baseadd% = &H3F8 'any valid COM port address (see the Windows Component Settings)
REM Possible port addresses are &H3F8(1016) = COM1, &H2F8(760) = COM2, &H3E8(1000) = COM3 and &H2E8(744) = COM 4.

CLS
Print "Scanning comp port registers. ESC to quit."
PRINT
print "reading from base address: ";Baseadd%

DO
x$ = INKEY$
for i = 0 to 7
locate 10+i, 10
print "Base address + ";i; ": ";Inp32(Baseadd% + i); " "
next i
IF x$ = CHR$(27) THEN EXIT DO 'Escape key quits
LOOP

ftbrady
Member
Posts: 16
Joined: Mon Mar 07, 2016 9:48 pm

Re: Windows XP inpout32.dll copied to Windows 7

Post by ftbrady » Mon Mar 07, 2016 10:39 pm

I'm brand new to the forum. I've been using inpout32 for several years with a dot net visual basic application on a xp machine. I'm now trying to get the same application working on a new windows 7 machine with a usb - parallel port adapter cable. I haven't found a download link that specifically refers to 32 bit windows 7, so I just copied my old inpout32.dll from the xp machine to the w7 machine. I see that my app uses hard coded port 56448 (&HDC80) when itlzg the parallel port i/o. It's not working - software exception when trying to write to the port:

"(WrtPort) error : Unable to load DLL 'inpout32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

(I had put the old inputout32.dll in the same folder as my application executable in the windows 7 system).

I've completely forgotten how I got all this working on the XP system.
Is there an "installation" process to incorporate the dll?

Thanks
ftbrady

User avatar
phil
Site Admin
Posts: 5398
Joined: Sun Apr 06, 2003 11:12 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by phil » Mon Mar 07, 2016 11:19 pm

If you use the latest version of Inputx64 on my website, it should work with both x86 (inpout32.dll) and x64 (inpoutx64.dll). The 32but DLL contains drivers for both x86 and x64 editions of Windows and there is an Installer (install.exe) which forces elevated access (UAC) which is required the first time InpOut32 is run to ensure you have the privileges to install the driver.

Thanks,
Phil
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9, Logitech MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, Intel i5-6600k, Asus 170-A, 16GB DDR4,
nVidia GeForce GTX 970, 2xEvo 850 (RAID 0), 2x2TB WD Black (RAID1)

danube
New User
Posts: 7
Joined: Thu Mar 03, 2016 11:12 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by danube » Tue Mar 08, 2016 4:29 pm

Hi Phil,

Thanks for the reply. Are you saying I should include inpoutx64.dll instead of inpout32.dll in my QB64 code?

Under Win 7, I see that QB64 runs as a 32 bit app, so installed the input32.dll. Should I use the x64 version instead?

Dan

ftbrady
Member
Posts: 16
Joined: Mon Mar 07, 2016 9:48 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by ftbrady » Tue Mar 08, 2016 5:31 pm

Phil
Thanks for the info, but I'm sorry to say there's a little confusion remaining.
You wrote:
If you use the latest version of Inputx64 on my website, it should work with both x86 (inpout32.dll) and x64 (inpoutx64.dll). The 32but DLL contains drivers for both x86 and x64 editions of Windows and there is an Installer (install.exe) which forces elevated access (UAC) which is required the first time InpOut32 is run to ensure you have the privileges to install the driver.

I was unable to find "the latest version of Inputx64"
Is that a typo? What name, exactly, should I be looking for in the downloads?
So sorry I get easily confused.
Thanks for all you do.
ftbrady

User avatar
phil
Site Admin
Posts: 5398
Joined: Sun Apr 06, 2003 11:12 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by phil » Tue Mar 08, 2016 8:54 pm

Yes it was a typo!
On my inpout32/x64 website:
Download Links:

The following links are for my x64 port of the source code and examples of how it can be used:

Binaries only - x86 & x64 DLLs and libs.
For end users of applications designed for use with InpOut32 (for example LCDSmartie) this is all you need.
It also contains everything required to develop your own application. See the readme file for further information.
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9, Logitech MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, Intel i5-6600k, Asus 170-A, 16GB DDR4,
nVidia GeForce GTX 970, 2xEvo 850 (RAID 0), 2x2TB WD Black (RAID1)

User avatar
phil
Site Admin
Posts: 5398
Joined: Sun Apr 06, 2003 11:12 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by phil » Tue Mar 08, 2016 8:58 pm

danube wrote:Hi Phil,

Thanks for the reply. Are you saying I should include inpoutx64.dll instead of inpout32.dll in my QB64 code?

Under Win 7, I see that QB64 runs as a 32 bit app, so installed the input32.dll. Should I use the x64 version instead?

Dan
No, if qb64 runs as a 32bit app, you should use inpout32.dll from my website, which will install a 64bit driver on Win 7 x64 or 32bit driver on Win 7 x86. You have to run elevated to install the driver (ie. the first time you use the DLL). There is an installdriver.exe to achieve that, or you can run QB64 as administrator too.

EDIT: I see there is some confusion here because ftbrady hijacked your thread. Don't you hate it when that happens! My reply was to him rather than you. To be honest, I have no idea why you have that problem were it only works when the port is open in another program. I have in the past hit the serial port registers directly using InpOut32 (and that's why I ported it in the first place) but it was many years ago and I dont actually use InpOut32 myself anymore. So unfortunately, i dont know if I can help you :(
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9, Logitech MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, Intel i5-6600k, Asus 170-A, 16GB DDR4,
nVidia GeForce GTX 970, 2xEvo 850 (RAID 0), 2x2TB WD Black (RAID1)

ftbrady
Member
Posts: 16
Joined: Mon Mar 07, 2016 9:48 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by ftbrady » Tue Mar 08, 2016 9:53 pm

I apologize for hijacking the thread - it 'seemed' to be what I was looking for.

I successfully downloaded "InpOutBinaries_1501" and the readme.txt says to run the "InstallDriver.exe" in \Win32 folder.
I'm guessing that, for my Windows 7 environment this means to use the "(x86)" Program folder?

If so, where should the other 3 files in the Win32 folder be located when I run "InstallDriver.exe" ?
(inpout32.dll, inpout32.h, and inpout32.lib files)

After everything is in the right place and I execute "InstallDriver.exe" in the (x86) folder - am I done?
I ask this because I thought the right place for the 3 inputout32 files would have been the folder containing the executable for the application that will be accessing the parallel port.

Very sorry for all this, Phil, but the only thing close to this that I have ever done was the inpout32.dll I installed in my old Windows XP system - and that was just a matter of putting inpout32.dll in a folder.

Please stick with me just a little longer and I will be out of your hair for another 10 years or so.
Thanks,
ftbrady

danube
New User
Posts: 7
Joined: Thu Mar 03, 2016 11:12 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by danube » Tue Mar 08, 2016 10:37 pm

Thanks Phil,

Yeah, it's a weird problem. I think your drivers are installed fine. The .sys and .dll are in the right places. And it works, but of course, only with that third party app running. If I have time, I'll try to find a 4th party app. and see if it too works.

But an interesting thing happened today. My computer reboot on me (it does that every once in a while), and when it came back up, some COM port bits must have been stuck because for a while my QB program worked fine WITHOUT the 3rd party com app.! I then did another reboot, and the problem returned.

I just wish I knew more about how the serial port works under Win7 (well, enough to figure this out, and no more!). Clearly there are some people doing it, but not in BASIC usually. I will try to see if I can get the COM port to work in VBA.

Dan

ftbrady
Member
Posts: 16
Joined: Mon Mar 07, 2016 9:48 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by ftbrady » Wed Mar 09, 2016 12:04 am

Dan
Regarding your Win7 serial port problems - I just wanted to pass along that the serial port is the first thing I got working on my Win7 machine. I used a CableMax USB serial adapter and it worked the first time. Again, I'm sorry I Hijacked the thread with my inpout questions.
ftbrady

danube
New User
Posts: 7
Joined: Thu Mar 03, 2016 11:12 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by danube » Wed Mar 09, 2016 12:30 am

Thanks ftbrady,

What are you using to communicate with the serial port? I presume you are using the inpout32.dll, but what language?

Dan

danube
New User
Posts: 7
Joined: Thu Mar 03, 2016 11:12 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by danube » Wed Mar 09, 2016 12:34 am

p.s. No worries about hijacking my thread. We're working towards the same goal more or less.

I really don't think my problem is with inpout32.dll, nor its installation, but rather my implementation of windows....

Wait a minute. Tell me more about the serial port you are using. Is it on USB? The big difference between my work machine and my home machine is that at home I have to use a USB-serial adapter. But at work, I've got some annoying company Anti-virus, and I need to ask if that has any control over the serial ports.

If I can get input32.dll working at home, it will go a long way towards convincing me the problem is my machine at work, and not win 7.

Dan

ftbrady
Member
Posts: 16
Joined: Mon Mar 07, 2016 9:48 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by ftbrady » Wed Mar 09, 2016 12:44 am

Dan
I'm not using inpout on my win7 machine. The application is in Visual Basic (dot NET) that I'm transporting from windows XP machine. I developed the code years ago, but I can take a look and we can compare notes if helpful?
ftbrady

danube
New User
Posts: 7
Joined: Thu Mar 03, 2016 11:12 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by danube » Wed Mar 09, 2016 1:43 am

ftbrady,

Well, if your code works on VBa, I am interested, but not VB.net. I am trying (very hard) to avoid installing any IDEs that I have to install myself, or have to learn anew. That's why I am sticking to QB64, and I am also going to try VBa since it comes installed with excell and I have a little experience in that environment (though it is still confusing to me). I'm still hoping to get QB64 to work, since I really like the ease of programming in BASIC.

Thanks.

Dan

ftbrady
Member
Posts: 16
Joined: Mon Mar 07, 2016 9:48 pm

Re: inpout32.dll (1.5.0.1) win7 and QB64 works with issues

Post by ftbrady » Wed Mar 09, 2016 1:54 am

Dan
I wish you luck - maybe try something like MSDN Social forum - an awful lot of experience there.
ftbrady

Post Reply