Resize of ATL Activex control hosted in Internet Explorer - activex

We have an ATL Activex control, which is hosted in Internet Explorer. We wanted to re-size the ATL activex control along with the IE browser. Handled the WM_SIZE as below:
MESSAGE_HANDLER(WM_SIZE, OnSize)
which has written the OnSize handler for the respective class. But, the WM_SIZE even is not getting fired.
We have created the ATL activex in IE as below:
OBJECT classid="clsid:89431EB0-39AC-4544-A0AA-69247BA16B04" id="ISRControl" height="100%" width="100%"
Please, let me know if you have any suggetions. So, that it would be helpul for us.
Thank You

Yes finally I got the solution.
actually In my ATL Activex control I have already handled the WM_WINDOWPOSCHANGED event. so WM_SIZE event is not post to control if it has the WM_WINDOWPOSCHANGED. WM_WINDOWPOSCHANGED handler will get the new size co-ordinates.so I Called the MoveWindow of the control. so it automatically fires the WM_SIZE.

Related

Cancel navigation for FMX TWebBrowser

I'm using using a TWebBrowser in a FireMonkey app (Delphi 10.3.3) and loading some dynamic HTML into it like this
DocumentWebBrowser.LoadFromStrings(browser_html,'');
In that HTML I have several links like
<a id="position_26" class="cdimmed" href="pos_26">SOME WORD</a>
I need to intercept when the user follows that link, without loading new HTML (just by running some JavaScript). DocumentWebBrowserShouldStartLoadWithRequest is never triggered. DocumentWebBrowserDidStartLoad is triggered, but I didn't find a way to stop the browser to stop the navigation. I tried calling Stop, FinishLoading and FailLoadingWithError without success. Any way to achieve this (without using CEF4)?

How to suppress ActiveX warning dialogs in TEmbeddedWB?

In a Delphi XE8 VCL Form project using TEmbeddedWB, in EmbeddedWB1 for security reasons I set both DontExecuteActiveX and DontDownloadActiveX properties to True:
I have also disabled dialog-boxes in EmbeddedWB1 by setting EmbeddedWB1.DialogBoxes.DisableAll to True:
However, when I navigate to a page like:
https://www.iplocation.net/
or:
http://www.hostip.info/
I still get ActiveX warning dialog boxes:
One or more ActiveX controls could not be displayed because either: 1)
Your current security settings prohibit running ActiveX controls on
this page, or 2) You have blocked a publisher of one of the controls.
As a result, the page might not display correctly.
So how can I suppress these dialog boxes?
Locate Your EmbeddedWB component -> Events -> OnScriptError:
fill these lines here:
continuescript:=true;
showdialog:=false;
It's much better that turnin on "Silent" mode, some webpages not loading correctly with "Silent:=True" parameter...
Hope it helps

Delphi: WebBrowser "ActiveX control" error

On some websites I navigate with TWebBrowser, after the loading of the site I get this:
One or more ActiveX controls could not be displayed because either:
1) Your current security settings prohibit running ActiveX controls on
this page or 2) You have blocked a publisher of one of the controls
As a result, the page might not display correctly
I don't care if the page will display correctly or not, I just want it to display without this message!
How to disable this?
I have tried to temporarily enable everything in the Internet Options but no success, the message still appears.

WM_QUERYENDSESSION is not working in IE8 activeX control

I have a ActiveX control written in Delphi 6 which handles WM_QUERYENDSESSION message to pop up a message box to let users to save changes before shutting down windows.
It works fine in IE6 / IE7 , but in IE8 the ActiveX control cannot receive WM_QUERYENDSESSION , how to solve this?
thanks

Defaultinterface in TChromium is missing

We are trying to change the builtin browser component from TWebBrowser to TChromium.
It is used mostly for displaying maps from Google and Bing. The communication from the javascript to Delphi is done with COM.
When trying to change the browser to TChromium it fails to compile this code.
if supports(fBrowser.defaultInterface, IOleObject, fOLE) then
because defaultInterface is missing from TChromium.
EDIT:
Is it possible to still communicate from javascript to Delphi with Chromium?
I'm aware of that they are not compatible and I have to rewrite code. I just want to know how to get a result from javascript to delphi. Note I am using Delphi 2007 so the extended RTTI cannot be used.
Regards
Roland Bengtsson
I never used it myself, but TChromium appears to be a wrapper around the "Chromium" web browser, while the original TWebBrowser from Delphi is a wrapper around an IE Browser.
TWebBrowser.defaultInstance gives you the COM object of the IE Browser. For the Chromium browser you can apparently use TChromium.Browser, it gives you an object of type ICefBrowser. The TChromium people were smart not to name the property defaultInstance because there's a lot of code out there casting from the return of defaultInstance to other interface types: If TChromium.Browser was named the same, the cast would compile and fail at run time. Because the IE Browser is obviously not a Chrome browser, and I doubt the Chromium browser fully implements all IE interfaces.
Using TChromium, you can invoke scripts easily via ExecuteJavaScript. And you can invoke Delphi code from scripts, which you can use to send return values back from a JavaScript function to Delphi.
See this question and my answer there about doing this using extensions.
There also seems to be work in progress for functions like EexecuteScriptAndReturnValue but as the time of writing they are not contained in the trunk.
And regarding TWebBrowser.DefaultInterface I agree with Cosmin: the best analogy is probably TChromium.Browser as you can access frames and subsequently DOM, etc. from there.

Resources