Convert hb_parc() in LPTSTR

Postby Maurizio » Mon Oct 27, 2008 6:09 pm

Antonio ,

doesn't works :( ,

I try also :
PDC_ExtTextOut(hPrDC,100,100, 0, NULL, wName, 15, NULL);

I think that the problem is
TCHAR * wName = ( TCHAR * ) hb_xgrab( len * sizeof( TCHAR ) );

Thank Maurizio
Last edited by Maurizio on Tue Oct 28, 2008 7:45 am, edited 1 time in total.
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Postby Antonio Linares » Mon Oct 27, 2008 6:15 pm

Maurizio,

Try this:

PDC_ExtTextOut(hPrDC,100,100, 0, NULL, wName, 31, NULL);

I think that the problem is
TCHAR * wName = ( TCHAR * ) hb_xgrab( 31 );
Last edited by Antonio Linares on Mon Oct 27, 2008 6:17 pm, edited 1 time in total.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Oct 27, 2008 6:17 pm

Maurizio,

A wide string uses to be the double length of the original string, as each char requires two bytes
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Maurizio » Tue Oct 28, 2008 7:48 am

Antonio ,
same effect :( ,

you cann see the variable wname

MessageBox( 0, wName, L"TRUE", 0 );

Maurizio [/u]
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Postby Antonio Linares » Tue Oct 28, 2008 8:17 am

Maurizio,

Please try this:

MessageBox( 0, AnsiToWide( "Hello World" ), L"TRUE", 0 );
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Maurizio » Tue Oct 28, 2008 10:36 am

Antonio ,
I have thi serror
error C2664: 'AnsiToWide' : cannot convert parameter 1 from 'c
har [12]' to 'char'
This conversion requires a reinterpret_cast, a C-style cast or function-
style cast


Regards MAurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Postby Antonio Linares » Tue Oct 28, 2008 10:50 am

Maurizio,

You need to include this prototype:

TCHAR * AnsiToWide( char * );

HB_FUNC( ... )
{
...
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Maurizio » Tue Oct 28, 2008 11:25 am

Antonio ,
Now the error is
error LNK2019: unresolved external symbol "unsigned short * __cdec
l AnsiToWide(char *)" (?AnsiToWide@@YAPAGPAD@Z) referenced in function HB_FUN_PR
INTLINE

Maurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Postby Antonio Linares » Tue Oct 28, 2008 12:35 pm

Maurizio,

As you are compiling in C++ mode, then please declare it this way:

extern "C" {
TCHAR * AnsiToWide( char * );
};
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Maurizio » Tue Oct 28, 2008 1:31 pm

Antonio ,

exceptional it works :P ,

Now I cann finish the class .

Thank for your help.

MAurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Postby Antonio Linares » Tue Oct 28, 2008 5:33 pm

Maurizio,

Glad to know that you got it working :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests

cron