急急急--关于WebBrowser2->get_LocationName获取中文标题该如何处理!!!!

ford99 2007-04-02 05:53:52
例如"CSDN 社区中心"是一个网页的标题
我设置
BSTR bstrTitle;
char tempTitle[1024]="";
int i;
int k=0;
WebBrowser2->get_LocationName(&bstrTitle);
if (bstrTitle!=NULL)
{
for(i=0; ; i++)
{
if((bstrTitle[i]==0)&&(bstrTitle[i+1]==0))
break;
tempTitle[k++]=bstrTitle[i];
}
}
这样我的tempTitle是获取了网页标题,但是其中的中文显示是乱码,请问
该如何处理才能获取中文才能正确显示中文网页?
...全文
270 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
jixingzhong 2007-04-03
  • 打赏
  • 举报
回复
http://blog.csdn.net/jixingzhong/archive/2006/12/28/1465419.aspx
jixingzhong 2007-04-03
  • 打赏
  • 举报
回复
注意 locale 的使用
蒋晟 2007-04-03
  • 打赏
  • 举报
回复
http://msdn2.microsoft.com/en-us/library/xda6xzx7(VS.71).aspx
ford99 2007-04-03
  • 打赏
  • 举报
回复
int MultiByteToWideChar(
UINT CodePage, // code page
DWORD dwFlags, // character-type options
LPCSTR lpMultiByteStr, // address of string to map
int cchMultiByte, // number of bytes in string
LPWSTR lpWideCharStr, // address of wide-character buffer
int cchWideChar // size of buffer
);
int WideCharToMultiByte(
UINT CodePage, // code page
DWORD dwFlags, // performance and mapping flags
LPCWSTR lpWideCharStr, // address of wide-character string
int cchWideChar, // number of characters in string
LPSTR lpMultiByteStr, // address of buffer for new string
int cchMultiByte, // size of buffer
LPCSTR lpDefaultChar, // address of default for unmappable
// characters
LPBOOL lpUsedDefaultChar // address of flag set when default
// char. used
);
举个例子行不?
perfervid 2007-04-02
  • 打赏
  • 举报
回复
你查查

WideCharToMultiByte

MultiByteToWideChar

64,646

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧