DllImport

Z

Zoltan

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

I am trying to call an unmanaged function that is in a dll written in
C++. I did call the unmanaged fucntions already and i know almost
everything. My problem is that i do not have those datatypes under C#
that i had under C++. For example :

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

Neither LPCTSTR nor LPHTALKER are referencable from C#. If i put a
simple string instead of these types the function will be called
without a single error, but then i do not know the information because
of inproper casting, for example, instead of color, i get a 2 digit
number.....

To my best, the best would be if i re-declare these datatypes under C#
so i will have proper casting ?! Or could i import "3rd party"
datatypes from the dll into C# ?

I have put a similar question on the web before and i was told what is
what and so this would be my last question to make this work. Microsoft
advised me a book on API/COM but i hope that i don't need to read an
arm thick book to complete the answer.

Any help is greatly appreciated.

Zoltan.
 
S

SirMike

Dnia 17 Nov 2006 07:06:24 -0800, Zoltan napisa³(a):
DWORD etCreateTalker (
LPCTSTR lpszReaderName,
LPHTALKER phTalker,
DWORD dwFlags
);

DWORD is just simple value type.
Look in windef.h and everything will be clear.

typedef unsigned long DWORD;

LPCTSTR is a pointer to the String.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top