Click here to Skip to main content
15,882,329 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
i have one dll Apms.dll which is not supported to WPF (.net).

So i need to write a wrapper in C++ and use it in WPF appln.

iam new to wrapper creation . i have some API calls for Apms.dll .They are

RETCOND API1090 ApmsApiSrvConnect
( LPTSTR szServerName, LPDWORD dwClientNbr,
LPDWORD dwReserved );

Return code is of

R_NORMAL

R_NOCONN

R_NOACTIVE ..

can anybody help me in writing this Wrapper for the Api method in C++ and connect with my WPF application?
Posted

You need to look into the use of P/Invoke[^] for accessing C style DLL functions from .NET applications.
 
Share this answer
 
Comments
Espen Harlinn 17-Apr-13 10:40am    
Right, or use C++/Cli :-D
Using a mixed mode C++/CLI DLL might be an easy way to provide a .NET friendlier interface for calling code in APms.dll. However if you only have a few functions to call, then the P/Invoke approach would be a better choice.

Typically, if P/Invoke is sufficient then you should go with it. On the other hand, if the DLL is relatively complex to use, wrapper might also help to simplify the use of its function.

I guess that Apms.dll is external to your company and that you only have the DLL (and its library for linking).

Because, if you have the full source code, you might consider compiling the DLL in mixed mode and have the .NET wrapper in the same DLL,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900