|
// *********************************************************
// ドキュメントのロード(HTML使用)
// *********************************************************
BOOL LboxIEControl::LoadFit( LboxString *LString )
{
return LboxIEControl::LoadFit( LString->szLboxString );
}
BOOL LboxIEControl::LoadFit( LPTSTR lpPath )
{
if ( this->pIEControl == NULL ) {
this->SetControlErrorMessage();
return false;
}
if ( this->hWnd == NULL ) {
this->SetWndErrorMessage();
return false;
}
LboxInfo Info;
LboxString Buff;
LboxTool Tool;
if ( !(Info.TempPath( &Buff ) ) ) {
Tool.ProgramDirectory( &Buff );
}
LboxFileSystem Fs;
LboxString Path;
Fs.CreateTempFile(
Buff.szLboxString,
"LIC",
&Path
);
LboxTextFile Txt;
Txt.WriteOpen( &Path );
Txt.Put( "<HTML>" );
Txt.Put( "<BODY>" );
Txt.Put( "<IMG src=\"" );
Txt.Put( lpPath );
Txt.Put( "\" style='position:absolute;left:0;top:0'>" );
Txt.Put( "</BODY>" );
Txt.Put( "</HTML>" );
Txt.Close();
_bstr_t bstrValue;
VARIANT vParam;
bstrValue.operator = (Path.szLboxString);
vParam.vt = VT_BSTR;
vParam.bstrVal =
(wchar_t*)(bstrValue.operator const wchar_t * ());
BOOL bError;
bError = false;
SHDocVw::IWebBrowser2Ptr pIE;
pIE.operator = (
(SHDocVw::IWebBrowser2Ptr *)&(this->pIEControl)
);
try {
if ( pIE != NULL ) {
pIE->Navigate2(&vParam);
}
else {
bError = true;
}
}
catch (_com_error &e)
{
bError = true;
}
this->pIEControl = pIE.Detach( );
return !bError;
}
| |