Solved

Automation object

Posted on 2002-07-02
9
471 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
Comment Utility
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
Comment Utility
i'll try date later.
Regards
0
 

Author Comment

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

0
 
LVL 7

Expert Comment

by:Cynna
Comment Utility
Did you add Windows, ActiveX to your uses clause?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

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

0
 
LVL 26

Expert Comment

by:Russell Libby
Comment Utility

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
Comment Utility
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
Comment Utility
Free4all, thanks for the points.

rllibby, thanks, you're fair player.

0
 

Author Comment

by:Free4all
Comment Utility
it's working very fine
Thank you all

Best Regards
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now