Click here to Skip to main content
15,921,716 members
Home / Discussions / Mobile
   

Mobile

 
Questionnew process and clipboard Pin
likefood26-Jan-06 6:48
likefood26-Jan-06 6:48 
AnswerRe: new process and clipboard Pin
likefood29-Jan-06 7:50
likefood29-Jan-06 7:50 
GeneralRe: new process and clipboard Pin
likefood30-Jan-06 12:22
likefood30-Jan-06 12:22 
Questionevc++4 and Loquendo TTS error LNK2019 problem Pin
jhenderson0126-Jan-06 0:27
jhenderson0126-Jan-06 0:27 
QuestionUsing SOAP header produces NullReferenceException on CF Pin
Ivanets25-Jan-06 23:47
Ivanets25-Jan-06 23:47 
QuestionO2 Xda Exec Price Pin
Mekong River24-Jan-06 12:26
Mekong River24-Jan-06 12:26 
QuestionBlueTooth Search Pin
sam_software23-Jan-06 5:20
sam_software23-Jan-06 5:20 
Questionpassing string from c# to c++ dll Pin
iriedel20-Jan-06 12:18
iriedel20-Jan-06 12:18 
Hi everbody,

I had problems passing strings from a c# project to an unmanaged c++ dll.

I work with vs .net 2005. I've created a smart device win32 dll with c++, exporting some symbols. In my dll i have two functions.

My Headerfile looks like this:

#ifdef __cplusplus
extern "C"
{
#endif

UNMANAGED_API int fnUnmanaged(LPCTSTR lpszMessage);

UNMANAGED_API int fnUnmanaged1(char* message);

#ifdef __cplusplus
} // extern "C"
#endif

and my .cpp is this:

UNMANAGED_API int fnUnmanaged(LPCTSTR lpszMessage)
{
return MessageBox(NULL, lpszMessage, _T("Unmanaged"), MB_OK);
}

UNMANAGED_API int fnUnmanaged1(char* message)
{
if (message[1] == (int) 'a') return true;
else return false;
}

Then I created a c# smart device pocket pc 2003 application. I import the dll and the two functions.

private void OnPressMe(object sender, EventArgs e)
{
fnUnmanaged("That tickles");

mystring= "Hallo";
bool test = fnUnmanaged1(mystring);

}
[DllImport("Unmanaged.dll")]
private static extern int fnUnmanaged(string message);

[DllImport("Unmanaged.dll", CharSet = CharSet.Unicode)]
private static extern int fnUnmanaged1(string filename);
}

The first function (MessageBox) works fine but the second was wrong. I tried the same thing with c++ dll and c# application for normal windows applications and everything works fine. "filename"was automatically converted from string to char*. But it does not work within a smart device application. The return value is always false. But it should be true if the string passed to the dll in the right way.

Both projects (c# and c++) were created automatically with .net. I changed nothing in the settings or elsewhere.

Has anybody an idea where the problem is?

Thanks, Ivonne


AnswerRe: passing string from c# to c++ dll Pin
Mike Dimmick22-Jan-06 0:34
Mike Dimmick22-Jan-06 0:34 
QuestionProblem spawning external program in PPC2003SE Pin
Dalkie18-Jan-06 22:44
Dalkie18-Jan-06 22:44 
Questiondrawing lines in Pocket PC program "Notes" Pin
muradx718-Jan-06 1:56
muradx718-Jan-06 1:56 
QuestionCan mobile device send and receive SMS through HTTP Protocol Pin
bibi040417-Jan-06 17:24
bibi040417-Jan-06 17:24 
AnswerRe: Can mobile device send and receive SMS through HTTP Protocol Pin
coder@coder.gr4-Feb-06 9:20
coder@coder.gr4-Feb-06 9:20 
QuestionSymbol MC3000: database howto? Pin
Hamid Reza Mohammadi17-Jan-06 4:12
Hamid Reza Mohammadi17-Jan-06 4:12 
AnswerRe: Symbol MC3000: database howto? Pin
Mike Dimmick22-Jan-06 1:07
Mike Dimmick22-Jan-06 1:07 
GeneralRe: Symbol MC3000: database howto? Pin
Hamid Reza Mohammadi22-Jan-06 4:11
Hamid Reza Mohammadi22-Jan-06 4:11 
QuestionEmbedded Visual C++ 4.0 installation problem Pin
Garth Watkins16-Jan-06 7:38
Garth Watkins16-Jan-06 7:38 
Questionwhat J# is? Pin
Sasuko13-Jan-06 2:55
Sasuko13-Jan-06 2:55 
QuestionWindow CE - Playing Sound Pin
karyeun11-Jan-06 21:41
karyeun11-Jan-06 21:41 
AnswerRe: Window CE - Playing Sound Pin
Jumba66663-Feb-06 10:14
Jumba66663-Feb-06 10:14 
QuestionJava J2SE/ME to .NET CF dll Pin
RolandAbt11-Jan-06 2:47
RolandAbt11-Jan-06 2:47 
Questionproblem WM 5.0 InstallDir with accents Pin
gbohl10-Jan-06 22:32
gbohl10-Jan-06 22:32 
QuestionWeb service with pocket PC Pin
Donnylies10-Jan-06 19:05
Donnylies10-Jan-06 19:05 
Questionhow to start Mobile Development Pin
shabonaa10-Jan-06 10:11
shabonaa10-Jan-06 10:11 
AnswerRe: how to start Mobile Development Pin
Hari Om Prakash Sharma23-Jan-06 8:10
Hari Om Prakash Sharma23-Jan-06 8:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.