FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Convert hb_parc() in LPTSTR
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Convert hb_parc() in LPTSTR
Posted: Mon Oct 27, 2008 06: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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Convert hb_parc() in LPTSTR
Posted: Mon Oct 27, 2008 06: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 );
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Convert hb_parc() in LPTSTR
Posted: Mon Oct 27, 2008 06: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
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Convert hb_parc() in LPTSTR
Posted: Tue Oct 28, 2008 07:48 AM

Antonio ,
same effect :( ,

you cann see the variable wname

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

Maurizio [/u]

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Convert hb_parc() in LPTSTR
Posted: Tue Oct 28, 2008 08:17 AM

Maurizio,

Please try this:

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Convert hb_parc() in LPTSTR
Posted: 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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Convert hb_parc() in LPTSTR
Posted: 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
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Convert hb_parc() in LPTSTR
Posted: 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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Convert hb_parc() in LPTSTR
Posted: 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
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Convert hb_parc() in LPTSTR
Posted: Tue Oct 28, 2008 01:31 PM

Antonio ,

exceptional it works :P ,

Now I cann finish the class .

Thank for your help.

MAurizio

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Convert hb_parc() in LPTSTR
Posted: Tue Oct 28, 2008 05:33 PM

Maurizio,

Glad to know that you got it working :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion