Click to See Complete Forum and Search --> : ExtTextOut Problem


sasi_kumar_irtt
December 7th, 2006, 04:46 AM
Dear all,
I wanted to display a string using ExtTextOut
I declared a map with int and string.
Later i copied the string value to a 'temp' varaible which is declared as below

string temp[10]

then i wished to display the string using ExtTextOut
I called ExtTextOut as follows
ExtTextOut((hDc,x,y,0,NULL,(LPCWSTR)temp[j].c_str(),strlen(temp[j].c_str(),),NULL);

But i got run time access violation what could be wrong and help me how to correct it

Tx
Sasi

golanshahar
December 7th, 2006, 06:02 AM
Are you using UNICODE build?

Cheers

sasi_kumar_irtt
December 8th, 2006, 01:46 AM
Yes Im using the embedded VC++ 4.2 emulator to compile and execute the program.
The same program can display the text uisng the TextOut function in windows XP, when i try with CE i struck up with error

humptydumpty
December 8th, 2006, 01:56 AM
use _T macro in case of WinCE and try again.hope this Will Work Proper for you.or you can use L (converts character or string to its Unicode counterpart)
Thanx

Krishnaa
December 8th, 2006, 02:15 AM
Why do you need to typecast string to LPCWSTR ??

string class don't return wide char pointer to string, you have to use wstring class for that.