471,315 Members | 1,544 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,315 software developers and data experts.

PLacing DLL funciton in a class

I have a dll that I need to use in an application that I am writing. Can
anyone point me in the direction of creating a class in my project that has
all the dllimport statements. I have used the dll but all the dll import
statements are within the same code..

Sample Code:
/// </summary>

public class Form1 : System.Windows.Forms.Form

{

[DllImport("ca3000API.dll",EntryPoint="_Initca3000" )]

public static extern int

int_Initca3000();

[DllImport("ca3000API.dll", EntryPoint="_GetConnectStr")]

public static extern int int_GetConnectStr(StringBuilder CS,

ref uint CSLen);

[DllImport("ca3000API.dll",EntryPoint= "_DeInitca3000")]

public static extern int int_DeInitca3000();

[DllImport("ca3000API.dll",EntryPoint= "_BadgeOperation")]

public static extern int int_BadgeOperation(int Facility,

Int64 Badge, ref string FirstName, ref string LastName,

ref string MI, UInt16 AGNo1, UInt16 AGNo2, UInt16 AGNo3,

UInt16 AGNo4, UInt16 AGNo5, UInt16 AGNo6, UInt16 Operation);

[DllImport("ca3000API.dll", EntryPoint = "_DoorOperation")]

public static extern int int_DoorOperation(int Panel, int Door,

int Time, int Operation);
Jan 25 '06 #1
1 1006
Can anyone point me in the direction of creating a class in my project that has
all the dllimport statements.


Just add a new class to your project and cut and paste all the
declarations into it.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jan 25 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.