Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ WPF
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
can anybody help me in writing this Wrapper for the Api method in C++ and connect with my WPF application?
Posted 17-Apr-13 3:24am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need to look into the use of P/Invoke[^] for accessing C style DLL functions from .NET applications.
Espen Harlinn at 17-Apr-13 10:40am
Right, or use C++/Cli :-D
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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,

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

  Print Answers RSS
0 OriginalGriff 410
1 Sergey Alexandrovich Kryukov 370
2 Maciej Los 285
3 ProgramFOX 275
4 CHill60 260
0 OriginalGriff 360
1 ProgramFOX 265
2 Maciej Los 235
3 CHill60 200
4 RyanDev 170

Advertise | Privacy | Mobile
Web02 | 2.8.150331.1 | Last Updated 17 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100