Dhtml的应用问题!(Delphi 网络通信/分布式开发)
我的Dhtml总是提示,不支持此接口.!!!
MailDhtml.DocumentHTML:='<html><body></body></html>';
self.MailDhtml.DocumentHTML :='HtmlBuffer.htm'
Re: DHTML CONTROL MICROSOFT UPDATE DISASTER
by Carlos Rocha <carlosCLEARTHISrocha@[EMAIL PROTECTED] > Feb 28, 2005 at 10:40 PM
Dick,
This was post in a Delphi's newsgroup,
"With all the stuff surrounding Hotfix KB891781 breaking applications that use DHTMLED.OCX, it might be not entirely Microsoft's fault after all. After some investigation, this is what I found:
1. DHTMLEDLib_TLB.pas declares:
TDHTMLEdit = class(TOleControl)
2. OleCtrls.pas declares:
TOleControl = class(TWinControl, IUnknown, IOleClientSite,
IOleControlSite, IOleInPlaceSite, IOleInPlaceFrame, IDispatch,
IPropertyNotifySink, ISimpleFrameSite, IServiceProvider)
3. OleCtrls.pas implements a method of IOleClientSite:
function TOleControl.GetContainer(out container: IOleContainer): HResult;
begin
Result := E_NOINTERFACE;
end;
Now, if your application uses TDHTMLEdit, you can trace the call to its DOM member in debug mode in Delphi (I use D2005). You will see that when you try to access DOM, the new version of DHTMLED.OCX makes a call back to your application requesting IOleContainer of your TDHTMLEdit component. The trace arrives at the GetContainer line in OleCtrls.pas, and that is exactly where "No such interface" comes from. Your own application returns it to DHTMLED.OCX, which in turn denies its access to the DOM object.
As was noted somewhere, this does not happen to VB applications. VB implements IOleClientSite.GetContainer, Borland VCL (both Delphi and C Builder) doesn't, and that is the difference and the cause of this problem.
I'm not a big specialist in this stuff. Can somebody suggest how exactly to implement GetContainer? And where - modify OleCtrls.pas, DHTMLEDLib_TLB.pas, or maybe create my own class, descendant of TDHTMLEdit?"
回复人: ly_liuyang(Liu Yang LYSoft http://lysoft.7u7.net)
首先,保存Delphi系统下的OleCtrls.Pas到你的程序所在目录
然后修改部分代码,增加IOleContainer接口
TOleControl = class(TWinControl, IUnknown, IOleClientSite,
IOleControlSite, IOleInPlaceSite, IOleInPlaceFrame, IDispatch,
IPropertyNotifySink, ISimpleFrameSite, IOleContainer)
//IOleContainer
function EnumObjects(grfFlags: Longint; out Enum: IEnumUnknown):
HResult; stdcall;
function LockContainer(fLock: BOOL): HResult; stdcall;
function ParseDisplayName(const bc: IBindCtx; pszDisplayName:
POleStr; out chEaten: Longint; out mkOut: IMoniker): HResult; stdcall;
function TOleControl.EnumObjects(grfFlags: Integer;
out Enum: IEnumUnknown): HResult;
begin
Result := E_NOTIMPL;
end;
function TOleControl.LockContainer(fLock: BOOL): HResult;
begin
Result := E_NOTIMPL;
end;
function TOleControl.ParseDisplayName(const bc: IBindCtx;
pszDisplayName: POleStr; out chEaten: Integer;
out mkOut: IMoniker): HResult;
begin
Result := E_NOTIMPL;
end;
并修改
function TOleControl.GetContainer(out container: IOleContainer):
HResult;
begin
container:= Self;
Result:= S_OK;
end;
CArray使用中的问题(VC/MFC 界面 )
我在View类中定义了CArray<int,int>m_plist;编译出现8个错误,主要有:
syntax error : missing ';' before '<'
error C2501: 'CArray' : missing storage-class or type specifiers
error C2059: syntax error : '<'
这是什么错误啊,
2。我理解CArray中第一个int就是这个数组中的存储的数据类型,那么第二个int是表示什么意思呢?看MSDN也没明白。
我定义了CArray<CLine,CLine>m_plist;
CLine data;
m_plist.add(data);
怎么会出现这样一个奇怪的错误
cannot convert parameter 1 from 'class CLine' to 'class CLine'
CArray<class TYPE, class ARG_TYPE>
TYPE
这个模板参数指明了存储在数组中的对象的类型。TYPE这个参数是CArray的返回值。
ARG_TYPE
这个模板参数指明了用来访问数组中的对象的参数的类型,通常是TYPE的参考。ARG_TYPE是用来传递给CArray的参数的类型。
you need a copy constructor to pass a class by value.
you can also use CArray<CLine,CLine& > to pass a class by reference.
如何创建一个没有地址栏的IE窗口 (VC/MFC 网络编程)
不希望让用户看到打开网页的地址,所以想创建一个没有地址栏的IE窗口,但不影响用户做其他操作时,仍能打开一个有地址栏的IE窗口。
http://www.codeproject.com/shell/AutomateShellWindow.asp
IWebBrowser2::put_AddressBar
http://msdn.microsoft.com/workshop/browser/webbrowser/reference/ifaces/iwebbrowser2/addressbar.asp
为什么WebBrowser下载完成一个页触发两次onDocumentComplete事件 (Delphi VCL组件开发及应用)
为什么WebBrowser下载完成一个页触发两次onDocumentComplete、onNavigateComplete、onNavigateComplete事件。
如果在这些事件下作处理数据容易出错,请教一下大家不如何解决。
因为你浏览的页面可能有框架,每个单独的框架都可能会触发DocumentComplete事件。
框架集页面会最后触发DocumentComplete事件。
发送事件的对象可以通过DocumentComplete事件的第一个参数访问