C/C++
You are currently browsing the articles from 哥哥万的博客 matching the category C/C++.
如果是字串转换.BCB有多个方法(如TStringConverter,或API的 WideCharToMultiByte/MultiByteToWideChar,VCL的WideCharToString/StringToWideChar等) 当然,BCB本身就支持三种字串,前两种可自动转,后一种有函数: String x; //GBK WideString y; //unicode UTF8String z; //utf8 x=y; //自动 y=x; //自动 z=AnsiToUtf8(x); x=Utf8ToAnsi(z);
Written by gegewan on 十一月 14th, 2008 with no comments.
Read more articles on C/C++.
先在浏览器中放一个浏览器控件,名字叫wb,然后用下面的代码来实现
void __fastcall TForm1::SpeedButton1Click(TObject *Sender) { IDispatch *wdoc = static_cast<IDispatch *>(wb->Document); IHTMLDocument2* pHtmlDoc2 = static_cast<IHTMLDocument2 *>(wdoc); if(pHtmlDoc2){ HRESULT hr = S_OK; IHTMLElement *pBodyElement; [...]
Written by gegewan on 十月 4th, 2008 with no comments.
Read more articles on C/C++.
由于做EasyNews我开始使用TXMLDocument,但是很遗憾的是,出现了一些莫名其妙的错误。基本代码如下:
//这里没有写错,TXMLDocument的构建函数就是这么定义的
//很奇怪的做法,一般来说T打头的都是VCL类,需要一个宿主
//但是这个类不需要宿主
TXMLDocument* MyXml=new TXMLDocument("");
try
{
MyXml->LoadFromFile("test.xml");
}
catch(…)
{
MyXml->DocumentElement=MyXml->CreateElement(
[...]
Written by gegewan on 九月 27th, 2008 with no comments.
Read more articles on C/C++.