Solved

Automation object

Posted on 2002-07-02
9
487 Views
Last Modified: 2010-04-04
I've created an Automation object that's used in a browser like this:
<script LANGUAGE="JavaScript">
var myactive;
myactive= new ActiveXObject("RS.Main")
myactive.Property1="<table><tr><td>ceva</td></tr></table>";
document.writeln(myactive.Property1);
</script>

The problem is that every time when i pres F5 to refrese the ontent of the page the browser give me this:

"An ActiveX Control on this page might be unsafe  to interact with other parts of the page. Do you what to allow this interaction?"

How do i pass this information form automaticly?
Regards
NTony.
0
Comment
Question by:Free4all
  • 5
  • 3
9 Comments
 
LVL 7

Accepted Solution

by:
Cynna earned 100 total points
ID: 7124112
Free4all,

You'll probably need to implement IObjectSafety in your ActiveX object.

I'm quoting Angus Robertson's advice on IObjectSafety implementation example:

<<

Add IObjectSafety to your main Class, and the following two functions.


  TRunProgX = class(TAutoObject, IObjectSafety, IRunProgX)
   FObjectSafetyFlags: DWORD;

  protected
   { IObjectSafety }
    function GetInterfaceSafetyOptions(const IID: TIID;  
        pdwSupportedOptions,   pdwEnabledOptions:  PDWORD): HResult;
        virtual; stdcall;
    function SetInterfaceSafetyOptions(const IID: TIID;
      dwOptionSetMask,  dwEnabledOptions: DWORD): HResult;
     virtual; stdcall;

------

{ TActiveXControl.IObjectSafety }

function TRunProgX.GetInterfaceSafetyOptions(const IID: TIID;
  pdwSupportedOptions, pdwEnabledOptions: PDWORD): HResult;
var
  Unk: IUnknown;
begin
  if (pdwSupportedOptions = nil) or (pdwEnabledOptions = nil) then
  begin
    Result := E_POINTER;
    Exit;
  end;
  Result := QueryInterface(IID, Unk);
  if Result = S_OK then
  begin
    pdwSupportedOptions^ := INTERFACESAFE_FOR_UNTRUSTED_CALLER or
      INTERFACESAFE_FOR_UNTRUSTED_DATA;
    pdwEnabledOptions^ := FObjectSafetyFlags and
      (INTERFACESAFE_FOR_UNTRUSTED_CALLER or
INTERFACESAFE_FOR_UNTRUSTED_DATA);
  end
  else begin
    pdwSupportedOptions^ := 0;
    pdwEnabledOptions^ := 0;
  end;
end;

function TRunProgX.SetInterfaceSafetyOptions(const IID: TIID;
  dwOptionSetMask, dwEnabledOptions: DWORD): HResult;
var
  Unk: IUnknown;
begin
  Result := QueryInterface(IID, Unk);
  if Result <> S_OK then Exit;
  FObjectSafetyFlags := dwEnabledOptions and dwOptionSetMask;
end;

>>
0
 

Author Comment

by:Free4all
ID: 7125867
i'll try date later.
Regards
0
 

Author Comment

by:Free4all
ID: 7125872
i'm using delphi3 and for IObjectSafety => error undeclared identifier.
I didn't find anythig about IObjectSafety.

0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 7

Expert Comment

by:Cynna
ID: 7126444
Did you add Windows, ActiveX to your uses clause?
0
 

Author Comment

by:Free4all
ID: 7126943
there is no IObjectSafety interface in Windows.pas or ActiveX.pas (i'm using Delphi3)

0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 7127013

Free4all,

Here is the def for IObjectSafety as well as the new flag constants. This should finish the solution for you. (points belong to Cynna though)

-----------------------------------

// Constants for IObjectSafety flags defined in Delphi 5
const
  INTERFACESAFE_FOR_UNTRUSTED_CALLER = 1
  INTERFACESAFE_FOR_UNTRUSTED_DATA = 2;

// New constants for IObjectSafety flags not included in Delphi
const
  INTERFACE_USES_DISPEX                    = 4;
  INTERFACE_USES_SECURITY_MANAGER        = 8;

// Type definition for IObjectSafety
type
  IObjectSafety = interface(IUnknown)
    ['{CB5BDC81-93C1-11CF-8F20-00805F2CD064}']
    function GetInterfaceSafetyOptions(const IID: TIID; pdwSupportedOptions,
      pdwEnabledOptions: PDWORD): HResult; stdcall;
    function SetInterfaceSafetyOptions(const IID: TIID; dwOptionSetMask,
      dwEnabledOptions: DWORD): HResult; stdcall;
  end;

-----------------------------------

0
 

Author Comment

by:Free4all
ID: 7129140
ok
i will implement all the above and then (if it works :)) i will give the point to Cynna

(i have a litle problem and thats way it will take a day ore two)

Best
Regards
NTony.
0
 
LVL 7

Expert Comment

by:Cynna
ID: 7129236
Free4all, thanks for the points.

rllibby, thanks, you're fair player.

0
 

Author Comment

by:Free4all
ID: 7129709
it's working very fine
Thank you all

Best Regards
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question