안녕하세요..
웹브라우저에 이미지를 올린후 클릭시 새창에서 클릭한 이미지를 띄울려고 합니다.
이미지가 보이는것까지는 되는데 클릭하면 스크립트 오류에러가 나네요..
고수님의 도움을 바랍니다.
아래는 소스입니다.
그럼 오늘도 즐거운 하루 보내세요..~~
void __fastcall TForm1::FormCreate(TObject *Sender)
{
WideString Blank = "About:blank";
CppWebBrowser1->Navigate(Blank);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString strhttp,strFileName;
strFileName = "C:\\Temp\\test.jpg";
strhttp = "";
strhttp +=" ";
AddHTML(strhttp);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::AddHTML(String html)
{
IDispatch* Document;
Document = CppWebBrowser1->Document;
::IHTMLDocument2 *pHTMLDocument;
::IHTMLElement *pHTMLElement;
HRESULT hr;
WideString InnerHTML = html;
hr = Document->QueryInterface(::IID_IHTMLDocument2,(void**)&pHTMLDocument);
if ( hr == S_OK )
{
hr = pHTMLDocument->get_body(&pHTMLElement);
if ( hr == S_OK )
{
pHTMLElement->insertAdjacentHTML( WideString("beforeEnd") ,InnerHTML);
pHTMLElement->Release();
}
pHTMLDocument->Release();
}
Document->Release();
}
//---------------------------------------------------------------------------
|