how to call custom dll made in eVC++ from .Net CF

A

Andrew Jones

Hi,

I have a dll made in eVC++ to grab exif data from digital images and I want
to call it from a .Net CF VB program for my Pocket PC 2002 unit.

I'm getting the following error:

----------------------------
A managed NotSupportedException occurred at Application::Run+0xf

Application::Run+0xf
Form1::Main+0xd

OK to terminate

----------------------------
Below is my code in VB .Net CF. I declare the dll under the Public Class for
Form1. I use the dll under a command button. It's suppose to return exif
(like camera model and date picture taken, etc.) data from digital images. A
similar dll was created in VC++ in VS 2003 and that works in VB.Net 2003
just fine on the desktop. I then had the dll recompiled in eVC++ and tried
the same desktop code in VB .Net CF 2003 but get the error I described
above. First am I declaring the dll correctly? How to you get to a dll from
..Net that was created in eVC++? If it's something in my eVC++ code then I'll
post the code to the eVC++ newgroup. Thanks for any help!

Andrew Jones

Code below:
Public Class Form1

Inherits System.Windows.Forms.Form

Public Declare Function ReadExif Lib _

"exif.dll" (ByVal szFile As String) As String

Public Declare Function GetExifCameraMake Lib _

"exif.dll" () As String



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim strLocation As String = "DSC06723.JPG"

Dim szString As String

'call the function

szString = ReadExif(strLocation)

MsgBox(szString)
 
D

Daniel Root

Andrew,
I've gotten that error before when passing the wrong data type into a
native method. I'm no expert on it, but here's a good article on
marshalling data types in P/Invoke (which is what you're doing):

http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/win_ce/htm/pwc_pinvokearguments.asp

There's a section on strings, which may be where you're issue is,
depending on how the string parameter is defined on the C++ side of
things...
-dr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top