App Unicode call NonUnicode dll

J

Josemi

Hi!,

I've got a great problem, and I don't have any idea how can I to
solve it. I hope that there is a solution to solve it :). Well. I've
got an App UNICODE that call a routine in a dll MBCS:

App UNICODE
CString dir;
bDameValorINI (dir, "Directorios", "Ejecutables", "C:\", true);

Routine dll MBCS

bool bDameValorINI (CString &valor, const CString &clave, const
CString &variable,
const CString &nombre_ficheroINI, bool
obligatorio);

When I try to call to that function, I can see with Debug that clave
is only "D" and variable = "E" into bDameValorINI. I tried to pass
with several ways:

1. bDameValorINI (dir, (char *) "Directorios", (char *)
"Ejecutables", "C:\", true);
2. char p1[25], p2[45];
strcpy (p1, "Directorios");
strcpy (p2, "Ejecutables");
bDameValorINI (dir, p1, p2, "C:\", true);

And all results are the same, :-(. clave = "D" and variable = "E"

My God, How can I do to solve it?

Many thanks in advance
Josemi


P.D.: I use VC++ v6.0. I can't to built the dll in MBCS mode
 
A

Amal P

Hi!,

I've got a great problem, and I don't have any idea how can I to
solve it. I hope that there is a solution to solve it :). Well. I've
got an App UNICODE that call a routine in a dll MBCS:

App UNICODE
CString dir;
bDameValorINI (dir, "Directorios", "Ejecutables", "C:\", true);

Routine dll MBCS

bool bDameValorINI (CString &valor, const CString &clave, const
CString &variable,
const CString &nombre_ficheroINI, bool
obligatorio);

When I try to call to that function, I can see with Debug that clave
is only "D" and variable = "E" into bDameValorINI. I tried to pass
with several ways:

1. bDameValorINI (dir, (char *) "Directorios", (char *)
"Ejecutables", "C:\", true);
2. char p1[25], p2[45];
strcpy (p1, "Directorios");
strcpy (p2, "Ejecutables");
bDameValorINI (dir, p1, p2, "C:\", true);

And all results are the same, :-(. clave = "D" and variable = "E"

My God, How can I do to solve it?

Many thanks in advance
Josemi

P.D.: I use VC++ v6.0. I can't to built the dll in MBCS mode

Hi,

I think you have to post it in VC++ group for a fast response.

Thanks and regards,
Amal P
 
M

Michael DOUBEZ

Amal P a écrit :
Hi!,

I've got a great problem, and I don't have any idea how can I to
solve it. I hope that there is a solution to solve it :). Well. I've
got an App UNICODE that call a routine in a dll MBCS:

App UNICODE
CString dir;
bDameValorINI (dir, "Directorios", "Ejecutables", "C:\", true);

Routine dll MBCS

bool bDameValorINI (CString &valor, const CString &clave, const
CString &variable,
const CString &nombre_ficheroINI, bool
obligatorio);

When I try to call to that function, I can see with Debug that clave
is only "D" and variable = "E" into bDameValorINI. I tried to pass
with several ways:

1. bDameValorINI (dir, (char *) "Directorios", (char *)
"Ejecutables", "C:\", true);
2. char p1[25], p2[45];
strcpy (p1, "Directorios");
strcpy (p2, "Ejecutables");
bDameValorINI (dir, p1, p2, "C:\", true);

And all results are the same, :-(. clave = "D" and variable = "E"

My God, How can I do to solve it?

P.D.: I use VC++ v6.0. I can't to built the dll in MBCS mode

Hi,

I think you have to post it in VC++ group for a fast response.

I guess not. This is a UNICODE question.

I don't known the answer because I am not familiar enough with UNICODE
but it is no wonder p1 id D and P2 is E if inputs are unicode.
Replacing strcpy() with wcscpy() and/or using L"" string should improove
the matter.


Michael
 
C

Colander

Amal P a écrit :


Hi!,
I've got a great problem, and I don't have any idea how can I to
solve it. I hope that there is a solution to solve it :). Well. I've
got an App UNICODE that call a routine in a dll MBCS:
App UNICODE
CString dir;
bDameValorINI (dir, "Directorios", "Ejecutables", "C:\", true);
Routine dll MBCS
bool bDameValorINI (CString &valor, const CString &clave, const
CString &variable,
const CString &nombre_ficheroINI, bool
obligatorio);
When I try to call to that function, I can see with Debug that clave
is only "D" and variable = "E" into bDameValorINI. I tried to pass
with several ways:
1. bDameValorINI (dir, (char *) "Directorios", (char *)
"Ejecutables", "C:\", true);
2. char p1[25], p2[45];
strcpy (p1, "Directorios");
strcpy (p2, "Ejecutables");
bDameValorINI (dir, p1, p2, "C:\", true);
And all results are the same, :-(. clave = "D" and variable = "E"
My God, How can I do to solve it?
P.D.: I use VC++ v6.0. I can't to built the dll in MBCS mode

I think you have to post it in VC++ group for a fast response.

I guess not. This is a UNICODE question.

I do guess so, when I start reading a message and stuff like CString,
dll and VC++ v6.0 is in the message I stop reading and go to the next
message, might be there is e real C++ question hidding between all the
MS stuff, but most off the time, it is some MS-related question.

Greets,
Bas
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top