row=mysql_fetch_row(res);
while(row!=NULL)
{
for(int i=0;i<fieldcount;i++)
{
TextOut(hdc,x,y,row[i],lstrlen(row[i]));
x += 50;
}
x = 0;
y += 20;
row=mysql_fetch_row(res);
}
强制转换后也是乱码,跪求如何解决
4 个解决方案
#1
TextOut -> TextOutA
#2
LPCWSTR 就是 wchar_t *
与 char * 转换需借助 AnsiString与WideString
wchar_t * lp; char *sp;
sp=AnsiString( WideString(lp)).c_str() 就成 char *
lp=WideString(AnsiString(sp)).c_btr() 就成了 wchar_t *
可以互换
与 char * 转换需借助 AnsiString与WideString
wchar_t * lp; char *sp;
sp=AnsiString( WideString(lp)).c_str() 就成 char *
lp=WideString(AnsiString(sp)).c_btr() 就成了 wchar_t *
可以互换
#3
LPCWSTR lp=L"*";
char *sp;
sp=AnsiString(WideString(lp)).c_str();
Caption=sp;
显示正确
char *sp;
sp=AnsiString(WideString(lp)).c_str();
Caption=sp;
显示正确
#4
widestring为未声明的标识符
#1
TextOut -> TextOutA
#2
LPCWSTR 就是 wchar_t *
与 char * 转换需借助 AnsiString与WideString
wchar_t * lp; char *sp;
sp=AnsiString( WideString(lp)).c_str() 就成 char *
lp=WideString(AnsiString(sp)).c_btr() 就成了 wchar_t *
可以互换
与 char * 转换需借助 AnsiString与WideString
wchar_t * lp; char *sp;
sp=AnsiString( WideString(lp)).c_str() 就成 char *
lp=WideString(AnsiString(sp)).c_btr() 就成了 wchar_t *
可以互换
#3
LPCWSTR lp=L"*";
char *sp;
sp=AnsiString(WideString(lp)).c_str();
Caption=sp;
显示正确
char *sp;
sp=AnsiString(WideString(lp)).c_str();
Caption=sp;
显示正确
#4
widestring为未声明的标识符