Click here to Skip to main content
11,804,008 members (80,052 online)
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 2: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 CPallini 310
2 Sergey Alexandrovich Kryukov 234
3 CHill60 230
4 Suvendu Shekhar Giri 200
0 OriginalGriff 3,140
1 Maciej Los 1,910
2 KrunalRohit 1,907
3 CPallini 1,845
4 Richard MacCutchan 1,187

Advertise | Privacy | Mobile
Web02 | 2.8.151002.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