Link to home
Start Free TrialLog in
Avatar of pigeonbr
pigeonbr

asked on

Paralle port programming, VC++ 6.0, W2K...turning on/off LED's on data out pins D0-D7

Hi,
There is alot of info out htere referring to this sort of work, like the famous "Controlling LED's with parallel port article in Codeproject which is years old, and other stuff that is also outdated. Looking around here there are some tidbits of info, but no clear direction for someone like myself who is not an expert. I know about the functions like CreateFile() and DeviceIoControl() , but it'S not obvious for me to know how to use them. Anyone already done small tests with just turning on/off LED's on the port and have some code example? I have theinpout32.dll, but when I try to register it (regsvr32) it tell me it's loaded, but the DLLRegisterServer Entry Point was not found...so the little codeproject example, which looks really like what I need, will not function. Any help out there please? Thanks!
Avatar of jkr
jkr
Flag of Germany image

>>I have theinpout32.dll, but when I try to register it (regsvr32) it tell me it's loaded, but the
>>DLLRegisterServer Entry Point was not found

It is probably just not a COM DLL, but a regular DLL, so no registration required. See e.g. http://www.logix4u.net/parallelport1.htm ("Parallel port Interfacing Tutorial"), it also refers to using that inpout32.dll on NT and later at http://www.logix4u.net/inpout32.htm
Avatar of pigeonbr
pigeonbr

ASKER

Why doesn't the program work if i don't have to register the .ddl then? Check out this link:
http://www.codeproject.com/csharp/csppleds.asp?msg=792594

Everything would seem to be there that I need, but it won't work....any ideas if it's not because of the .dll? Download the demo project and give it a try...I get a window that opens and the program seems to be looking for a file in c:\c#\LED\off.gif. Any help will greatly be appreciated. :)
This is a C#(!) managed app, it can only 'talk' to a Win32 DLL via P/Invoke or COM Interop. The DLL (inpout32) is not COM DLL, it only exports two functions ('Inp32()' and 'Out32()'), but no COM functionality that needs to be registered, thus no 'DllRegisterServer()'.
jkr:
Ok, then..so that's not for me. Can you help with my question by suggesting other options I can try please?
Err, I thought you wanted to use inpout32.dll? This is not the C# area ;o)
jkr:
No, not necessarily...like i said, I'm no expert...I'm just looking for the easiest way to do this , that's all. I have no preference...just a way out...so, if you have any suggestions, I'm all ears.:) Thanks!
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks jkr,...I will accept this and take time a little later to check it out...looks very interesting....if need be I will be back :) Thanks for your time!
Bruce
Hi jkr...I'm Back :)

Just tried the sample program, and made sure my inpout32.dll. was right one, and located in WINNT\system32 folder...but I still get errors when I run the commande line ex: partest1 write 888 255, which should light up my 8 LED's. The program give me an app error windoe with an address. Any ideas?
Are you running it under an admin account? That's necessary so the driver can be loaded.
Oh, the driver is called 'hwinterface.sys' and comes with http://www.logix4u.net/inpout32_source_and_bins.zip
Yes, I am running under administrator.

I'm trying the code out on another HD i have running W98, and more seems to be working....the LED's are illuminating opposite to what I would think...when I write 888 255, all leds go off, and the first 3 LED's (1,2,4) dont ever light up. Still working on it...when I get it working right in Win98, maybe easier to migrate to W2k.
About the driver 'hwinterface.sys' ,....where do I put i? In the system32 directory?
Maybe my parallel connector is defective, as my D0-D3 lights never go on....but the HEX output for the LED's which is normally 1,2,4,8,16, etc for D0,D1,D2,D3,D4,etc respectively is not in order. I'm scratching my head now :)
I got my wiring staightened out :)...haha...they are all ok now...had my DB 25 soldered backwards...still won't work in w2k...let me know abour the hwinterface.sys file...what do I do with it? Thanks.
All woorks fine now in W98. I can work each bit ....let me know....I will keep trying in W2k. Thanks
Sorry for the delay, I've been out for a while. Yes, the driver should be put in 'system32' also - that's the component that makes it possible to directly acces I/O ports in the 1st place.
jkr;
Ok...So my console app works now in W2K....thanks to your guidance and a few tests here. Now its to get the thing to work from a VC++ app and not from console application. Thanks for the help...you saved my many days of frustration! I appreciate it! I am now pointed in the right direction!
bruce
Quebec, Canada
You're most welcome ;o)