What is the right way to implement the win32 equivalent of the OUT opcode in dos to control the parallel port?
Under windows, OUT is "outlawed." All programs are supposed to call APIs, which communicate with device drivers, which in turn use the OUT opcode to communicate with the specific resource. With the parallel port, you have to use CreateFile and WriteFile and a few other APIs. There's a whole topic on communications in the Win32 Programmer's Reference help file.
That's only partially true. Windows 9x (and me too I suppose) don't care nor check what you do with the IO ports. OUT and IN are quite fine and do their job without any VxD. If you go to NT, only then will you need a WDM style driver.
I want to fully control the parallel port, i.e. setting the data & control bits, like you would use OUT (baseport+X), byte. Is this possible with the windows API?? AFAIK, the API controls the control bits and strobe bit etc. I can use OUT and IN with windows 9x, but my program should run both on 9x and NT and I would prefer using the windows API.
There is a dll that has been written to allow you to do this : http://www.internals.com has it (its called WinIO) - works 9x.2k.NT etc I found it literally by mistake when wandering/surfing (as I do for most things) and d/l it. It is supposed to do exactly what you want (which is why I d/l it) but every attempt I made to use it fell over with errors - if you get it working (i need to use 378h & 378h+2 with the old OUT command too for my project) pls let me know!! He doesn't have .asm examples but reckons they're around (I emailed him RE my prob) James http://james.ezylink.net.au
ernie... ther is some things you can't do in win9x with the io ports... such as diskwrites and a few others... just thought i should mention that...
Try this resource: http://www.lvr.com/parport.htm
Thanks for all the answers, I decided to use the WinIO library and have created an include file for it and rebuilt a new .lib file because the one generated by Visual C didn't work with masm. It works fine for me now, you can download the new library and include file at http://www.exagone.f2s.com/tempdata/AsmIO.zip Just copy WinIO.dll and WinIO.sys into the same dir as your program and then use the .lib and .inc from the AsmIO.zip. (James: I guess this will solve your problem) Thomas exagone.cjb.net