By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,652 Members | 1,697 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,652 IT Pros & Developers. It's quick & easy.

Accessing to I/Os (Serial, Parallel, USB, etc)

P: n/a
Hi, everyone.

I have written this code in Tubo C++ 3.0 earlier, and now I want to
port it to VC.NET:

int out=0;
out=(out & 0xDF);
outportb(0x378,out);
....
As you see, it seeks to parallel port directly (port: 0x378)

How can I write this code in VC++ .NET?
Nov 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
MSDousti wrote:
Hi, everyone.

I have written this code in Tubo C++ 3.0 earlier, and now I want to
port it to VC.NET:

int out=0;
out=(out & 0xDF);
outportb(0x378,out);
....
As you see, it seeks to parallel port directly (port: 0x378)

How can I write this code in VC++ .NET?


The problem is not VC++ or .NET, but Windows itself. Modern operating
systems - Windows NT/2000/XP/Linux/Unix/etc do not allow direct access to
hardware I/O ports from application programs. Rather, access to
hardware-level I/O is restricted to the OS kernel, and the device drivers
that support it.

In order to access hardware directly, you need to write (or use) a kernel
device driver.

What exactly are your trying to do? There may already be a way to
accomplish what you need with an existing high-level API.

-cd
Nov 16 '05 #2

P: n/a
search for winio.dll on net , it will help u to access
parallel port.

the syntax u wrote will run only on windows 98 and lower
Nov 16 '05 #3

P: n/a
"Carl Daniel [VC++ MVP]" <cp******@nospam.mvps.org> wrote in message news:<#n**************@TK2MSFTNGP10.phx.gbl>...
MSDousti wrote:
Hi, everyone.

I have written this code in Tubo C++ 3.0 earlier, and now I want to
port it to VC.NET:

int out=0;
out=(out & 0xDF);
outportb(0x378,out);
....
As you see, it seeks to parallel port directly (port: 0x378)

How can I write this code in VC++ .NET?


The problem is not VC++ or .NET, but Windows itself. Modern operating
systems - Windows NT/2000/XP/Linux/Unix/etc do not allow direct access to
hardware I/O ports from application programs. Rather, access to
hardware-level I/O is restricted to the OS kernel, and the device drivers
that support it.

In order to access hardware directly, you need to write (or use) a kernel
device driver.

What exactly are your trying to do? There may already be a way to
accomplish what you need with an existing high-level API.

-cd


I'm sure you know we can access a port through CreateFile(...)
function. Just I should set a handle to the approprite port, e.g
"COM1" or "LPT1".

I exactly want to know what other handles there are, e.g. for USB,
etc.
Nov 16 '05 #4

P: n/a
"MSDousti" <MS******@myrealbox.com> wrote in message
news:bf**************************@posting.google.c om...
I'm sure you know we can access a port through CreateFile(...)
function. Just I should set a handle to the approprite port, e.g
"COM1" or "LPT1".
Yes, that's true. Applications access devices through the intervention of
the operating system and its drivers which interacts with the hardware.
That's the point that Carl made.
I exactly want to know what other handles there are, e.g. for USB,
etc.


As I see it, your question is a bit open-ended as there are many kinds of
devices that plug into the USB bus. You might want to post again, possibly
with more detail as to what you want to do, in

microsoft.public.win32.programmer.kernel

Regards,
Will
Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.