可以在没有Application.ProcessMessages的情况下在Delphi中的线程中使用TWebBrowser吗? [英] Can the TWebBrowser be used in a thread in Delphi without Application.ProcessMessages?

查看:188
本文介绍了可以在没有Application.ProcessMessages的情况下在Delphi中的线程中使用TWebBrowser吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用TWebBrowser在Delphi服务器应用程序(XE2)中创建网页的屏幕截图。屏幕截图是通过对服务器的Web服务调用启动的,因此,为了保持可伸缩性,我希望在不依赖关键部分或Application.ProcessMessages进行网页渲染的情况下为请求提供服务。

I am trying to create screen captures of web pages in a Delphi server application (XE2) using TWebBrowser. The screen captures are initiated via web service calls to my server, so to preserve scalability, I would like to service the requests without relying on critical sections or Application.ProcessMessages to do the web page rendering.

可以用TWebBrowser完成吗?

Can this be done with TWebBrowser?

推荐答案

我已经已经在许多对象中做到了这一点,可悲的是,TWebBrowser对象与其父对象(特别是其HWND句柄)的关系非常紧密。 (另请参见TWebBrowser.HandleNeeded)。

I've done this already in a number of objects, and sadly enough the TWebBrowser object ties very much into it's parent object, and specifically its HWND handle. (see also TWebBrowser.HandleNeeded)

我获得的最佳结果是将TWebBrowser和表格封装在ActiveX库中,因此其背后的消息泵是与主应用程序分开。这样,ActiveX / COM可以处理所有线程和同步问题。

The best results I've had was by encapsulating the TWebBrowser and form in an ActiveX library, so the 'message pump' behind it is separated from the main application. This way ActiveX/COM handles all threading and synchronization issues.

这篇关于可以在没有Application.ProcessMessages的情况下在Delphi中的线程中使用TWebBrowser吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆