Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to get the HTML code for the parent of an ActiveX form Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
30-Aug-02
Category
ActiveX
Language
Delphi 3.x
Views
194
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

Does anyone know how to get the HTML code for the parent of an ActiveX form? The 
problem we have is an ActiveX Form which is loaded into a HTML document. This 
ActiveX form has buttons on it to load additional ActiveX forms. We want to place 
these additional ActiveX forms onto the current HTML page into a frame.

Answer:

The code below shows you how to grab the document, etc., from an ActiveForm.


1   uses
2     ActiveX;
3   
4   { ... }
5   
6   FBrowser: IWebBrowser2;
7   
8   TYourActiveForm.YourMethod;
9   var
10    vClientSite: IOLEClientSite; {ActiveX}
11    vContainer: IOLEContainer; {ActiveX}
12    vServiceProvider: IServiceProvider; {ActiveX}
13    vDocument: IHTMLDocument2; {MSHTML_TLB}
14    vBackgroundImage: OleVariant;
15  begin
16    vClientSite := ActiveFormControl.ClientSite;
17    vClientSite.GetContainer(vContainer);
18    if vContainer.QueryInterface(IServiceProvider, vServiceProvider) = S_OK then
19    begin
20      if vServiceProvider.QueryService(IID_IWebBrowserApp, IID_IWebBrowser2,
21        FBrowser) = S_OK then
22      begin
23        vDocument := FBrowser.Document as IHTMLDocument2;
24        vBackgroundImage := vDocument.body.style.backgroundImage;
25        if vBackgroundImage = '' then
26          vBackgroundImage := vDocument.body.getAttribute('background', 0);
27        if vBackgroundImge <> '' then
28          ShowMessage(vBackgroundImage)
29        else
30          ShowMessage('No background image defined.');
31      end;
32    end;
33  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC