From: zoltan_papp_123456 on
OS : Windows XP Professional
Environment : MS Visual Studio 2005
Language : C#

Hi, I am trying to write a windows application using C# that accesses
the Aladdin Etoken Pro USB device. (www.aladdin.com)


I am using [DllImport("eToken.dll")] to import functions and i am
using MarshallbyAttribute to import types/arguments of the functions.

1, What happens when the unmanaged function in the dll that i am
importing has data types that do not exist in the class under C# ? Do
i use the MarshallbyAttribute function or how does it work ?

I tried to access unmanaged datatypes using the following syntax :

[DllImport("eToken.dll")]
public static extern DWORD etCreateTalker (
MarshalAsAttribute(UnmanagedType.DWORD),
MarshalAsAttribute(UnmanagedType.LPCTSTR),.......

The following code is not proper though since the UnmanagedType
function does not return
the LPCTSTR type. So i would need something that is capable of bringing
over types that
are not returned by the UnmanagedType function.

etCreateTalker looks like this :

DWORD etCreateTalker (
LPCTSTR lpszReaderName,
LPHTALKER phTalker,
DWORD dwFlags
);

Any help welcome ! I spend my whole day on this so i want to get going.



Seems like that there aren't a lot of people out there whom want to
program the etoken in C#.


Zoltan.

From: Ivan Brugiolo [MSFT] on
Inappropriate for this forum.
One of the managed forum should be able to help you better.

For your poblem, this book is a good reading.
http://www.amazon.com/NET-COM-Complete-Interoperability-Guide/dp/067232170X/sr=8-1/qid=1162832823/ref=pd_bbs_1/104-5369991-1667124?ie=UTF8&s=books

--
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


<zoltan_papp_123456(a)yahoo.com> wrote in message
news:1162825642.586025.137980(a)k70g2000cwa.googlegroups.com...
> OS : Windows XP Professional
> Environment : MS Visual Studio 2005
> Language : C#
>
> Hi, I am trying to write a windows application using C# that accesses
> the Aladdin Etoken Pro USB device. (www.aladdin.com)
>
>
> I am using [DllImport("eToken.dll")] to import functions and i am
> using MarshallbyAttribute to import types/arguments of the functions.
>
> 1, What happens when the unmanaged function in the dll that i am
> importing has data types that do not exist in the class under C# ? Do
> i use the MarshallbyAttribute function or how does it work ?
>
> I tried to access unmanaged datatypes using the following syntax :
>
> [DllImport("eToken.dll")]
> public static extern DWORD etCreateTalker (
> MarshalAsAttribute(UnmanagedType.DWORD),
> MarshalAsAttribute(UnmanagedType.LPCTSTR),.......
>
> The following code is not proper though since the UnmanagedType
> function does not return
> the LPCTSTR type. So i would need something that is capable of bringing
> over types that
> are not returned by the UnmanagedType function.
>
> etCreateTalker looks like this :
>
> DWORD etCreateTalker (
> LPCTSTR lpszReaderName,
> LPHTALKER phTalker,
> DWORD dwFlags
> );
>
> Any help welcome ! I spend my whole day on this so i want to get going.
>
>
>
> Seems like that there aren't a lot of people out there whom want to
> program the etoken in C#.
>
>
> Zoltan.
>