Вопрос

All, I was trying to call the API which is defined in the DLL in the c# project. the code looks like below .

[DllImport("twain_32.dll", EntryPoint="#1")]
<Function declaration>

I know there are lots of public types which defined in this twain_32.dll,

and I knew there is function defined in the dll like below .

TW_UINT16 FAR PASCAL DSM_Entry( pTW_IDENTITY pOrigin,
                                  pTW_IDENTITY pDest,
                                  TW_UINT32    DG,
                                  TW_UINT16    DAT,
                                  TW_UINT16    MSG,
                                  TW_MEMREF    pData);

I don't know what class should I defined to reference in the c# to represent pTW_IDENTITY? Is there any tools to export all these type definition to c# class code . like header file .h in the c++ ? thanks.

Это было полезно?

Решение 2

There is no tool which would do this automatically, but there is a site called pinvoke.net which offers lots of P/Invoke signatures and examples. For your question, here is the link: TwIdentity (twain_32).

Also, there are open source libraries available which wrap the native functionality into managed classes, like: Saraff.Twain.NET or twain-in-dotnet, so looking at their source code you will probably find all the definitions you need.

Другие советы

PInvoke.net is a good resource for this.

They have some examples of the TWAIN_32 lib calls + a struct for pTW_IDENTITY

http://www.pinvoke.net/default.aspx/twain_32.TwIdentity

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top