Solved

Automation object

Posted on 2002-07-02
9
476 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
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 …

770 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