Solved

Automation object

Posted on 2002-07-02
9
473 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
 
LVL 7

Expert Comment

by:Cynna
ID: 7126444
Did you add Windows, ActiveX to your uses clause?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi 2010 Export to pdf 2 287
Making delphi communicate with a c# service 16 90
can't find the executable in Simulator 1 80
Delphi...Split view - idea? 1 42
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 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

14 Experts available now in Live!

Get 1:1 Help Now