Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Automation object

Posted on 2002-07-02
9
Medium Priority
?
512 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 7

Accepted Solution

by:
Cynna earned 400 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

609 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