Hello

How can i write something to parallel port ?
I use windows XP and .NET, but my program
is Win32 Application. I tried inpout32.dll but without success. First of
all i could not find any sources of inpout32 library, i
only found inpout32.dll, but when in Project/Properties/Linker/Input/
AdditionalDependencies i add inpout32.dll durring linking i receive:
Linking...
inpout32.dll : fatal error LNK1136: invalid or corrupt file
Results

(when i give incorrect file name path i receive error that non exsting
file - so linker
finds library inpout32.dll but something wrong is with that library).

Does anybody tried that ?
What can i do to get it working ?

I also found UserPort but it's usage was quite complicated for me...

Thanx
Michal

Re: Writing to parallel port by Igor

Igor
Mon Aug 22 09:21:13 CDT 2005

vertigo <null@com.pl> wrote:
> How can i write something to parallel port ?
> I use windows XP and .NET, but my program
> is Win32 Application. I tried inpout32.dll but without success. First
> of all i could not find any sources of inpout32 library

http://www.logix4u.net/inpout32.htm

A link to the source at the bottom.

> i
> only found inpout32.dll, but when in Project/Properties/Linker/Input/
> AdditionalDependencies i add inpout32.dll durring linking i receive:
> Linking...
> inpout32.dll : fatal error LNK1136: invalid or corrupt file

You need to link not to the DLL itself, but to its import library
(typically with a .lib extension). The aforementioned download includes
the import library under inpout32_source_and_bins/test
applications/VC_test_app
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



Re: Writing to parallel port by vertigo

vertigo
Mon Aug 22 10:18:31 CDT 2005


> You need to link not to the DLL itself, but to its import library
> (typically with a .lib extension). The aforementioned download includes
> the import library under inpout32_source_and_bins/test
> applications/VC_test_app

OK, i corrected this, added definitions:
short _stdcall Inp32(short PortAddress);
void _stdcall Out32(short PortAddress, short data);

but still durring linking i receive error:

Myprogram.obj : error LNK2019: unresolved external symbol _Out32@8
referenced in function _send_to_port.
Why ?

Thanx
Michal

Re: Writing to parallel port by vertigo

vertigo
Mon Aug 22 10:28:05 CDT 2005


i forgot to add that TestProgram compile without any problems,
but i do not build application but DLL library. Does it make any
difference ?

Thanx
Michal

Re: Writing to parallel port by Yannostopoulos

Yannostopoulos
Mon Aug 22 10:36:56 CDT 2005

Hi Michal,

why don't you use WriteFile API?

vertigo a =E9crit :

> i forgot to add that TestProgram compile without any problems,
> but i do not build application but DLL library. Does it make any
> difference ?
>=20
> Thanx
> Michal


Re: Writing to parallel port by Igor

Igor
Mon Aug 22 10:44:25 CDT 2005

vertigo <null@com.pl> wrote:
>> You need to link not to the DLL itself, but to its import library
>> (typically with a .lib extension). The aforementioned download
>> includes the import library under inpout32_source_and_bins/test
>> applications/VC_test_app
>
> OK, i corrected this, added definitions:
> short _stdcall Inp32(short PortAddress);
> void _stdcall Out32(short PortAddress, short data);
>
> but still durring linking i receive error:
>
> Myprogram.obj : error LNK2019: unresolved external symbol _Out32@8
> referenced in function _send_to_port.

Do you call them from a file with .c extension, by any chance? The
import library exports C++-style mangled names. Call it from a .cpp
file.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



Re: Writing to parallel port by vertigo

vertigo
Mon Aug 22 12:43:09 CDT 2005


> Do you call them from a file with .c extension, by any chance? The
> import library exports C++-style mangled names. Call it from a .cpp
> file.

OK, it did helped BUT:
the problem is that now my dll which is winamp plugin is not seen by
winamp.
If i change again filename from myplugin.cpp to myplugin.c winamp again
sees my plugin but then i can not use inpuot32 (because of errors
mentioned earlier). What can i do ?

I tried to use WriteFile as Yannostopoulos said:
char buf[1];
int BytesWritten;
HANDLE hParallel = CreateFile("LPT1", GENERIC_WRITE, 0, NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
buf[0] = 22; /* test value *
WriteFile(hParallel, buf, 1, (LPDWORD)&BytesWritten, 0);
CloseHandle(hParallel);

but such plugin hangs winamp :(
(WriteFile hangs winamp to be specific).
How can i solve my problem ?


Thanx
Michal

Re: Writing to parallel port by Igor

Igor
Mon Aug 22 14:14:14 CDT 2005

vertigo <null@com.pl> wrote:
>> Do you call them from a file with .c extension, by any chance? The
>> import library exports C++-style mangled names. Call it from a .cpp
>> file.
>
> OK, it did helped BUT:
> the problem is that now my dll which is winamp plugin is not seen by
> winamp.

I don't know much about WinAmp, but I guess it expects the functions to
be exported from your DLL with specific names. You can use a .DEF file
to specify exactly how to name your exported functions.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925