Starting IE7 with Anchor

Please discuss general Delphi programming topics here.

Starting IE7 with Anchor

Postby HPW » March 17th, 2007, 11:07 am

Hello,

I run into problems with the latest release of the IE7.
In the past it was no problem to launch the IE with an anchor:

I had first post this question on german delphipraxis:

http://www.delphipraxis.net/topic105767 ... t+ie7.html


Code: Select all
unit Test2;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ShellAPI, Registry,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  ts      : string;
  urlname : string;
begin
   with TRegistry.Create do
     try
       rootkey := HKEY_CLASSES_ROOT;
       OpenKey('\htmlfile\shell\open\command', False);
       try
         ts := ReadString('');
       except
         ts := '';
       end;
       CloseKey;
     finally
       Free;
     end;
   if ts <> '' then
   Begin
    ts := Copy(ts, Pos('"', ts) + 1, Length(ts));
    ts := Copy(ts, 1, Pos('"', ts) - 1);
    urlname := 'file://c:\Programme\newLISP\newlisp_manual.html#setq';
    ShellExecute(0, 'open', PChar(ts), PChar(urlname), nil, SW_SHOW);
   End;
end;

end.


So anyone an idea how to launch IE7 with an anchor?
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 238
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » March 17th, 2007, 12:29 pm

It's the IE's security alert that stops the action. :(

By the way, to lunch IE you do not need more than one line of code.
Code: Select all
ShellExecute(0, 'open', PChar(URL), nil, nil, SW_SHOW);
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby HPW » March 17th, 2007, 9:05 pm

>It's the IE's security alert that stops the action.

Does allowing anchors hurt the security?

And as a fellow on delphipraxis reports the firefox does work with them.
So how can I use IE for reading HTML-doc and jump to a specific place?
Does that hurt security?
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 238
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » March 18th, 2007, 4:48 pm

Microsoft instead of solving security issues, tells user there might be a security problem, would you like to continue. If user answer yes and a problem happens, Microsoft is in a safe place because user did that no Microsoft. :evil:

IE 7 doesn't do anything except rendering the page on the local machine. When user chose to run active controls the page will be reloaded and the anchor action will apply. Of course, this is not good for your case.

To disable this behaviour, you have to go to Internet Options, Advanced tab, and then under security group check "Allow active content to run in files in My Computer".
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby HPW » March 18th, 2007, 8:09 pm

Kambiz,

I think you do not get the right point here.

I do not talk about an ActiveX or any other security thing.

IE7 simply removes the anchor form the URL and does not ask anything from the user.

And checking "Allow active content to run in files in My Computer" does not change this behaviour.
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 238
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Johnny_Bit » March 18th, 2007, 10:35 pm

Kill it with fire!

Since the dawn of MS ShitTrap ( aka Windows ) it had been plagued with it's specific shit throwing ( aka Message System ). Use that to kill IE with Fire.

Fast forward to the point: run IE from your app, get handle to AddressBar, send there a message to insert url that you want, lie to it that user wanted it, Viola.

I'd had to dig about 1GB worth of my code to find some really good and clarifying example, but word out is, that some stuff like that lies on DSC.
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby Kambiz » March 18th, 2007, 11:48 pm

Sorry! I'm getting old. :)

A workaround can be using a url shortcut.
Create a temporary file with ".url" extension and pass it to ShellExecute.
The content of the file is something like this:

Code: Select all
[InternetShortcut]
URL=file:///c:/Programme/newLISP/newlisp_manual.html#setq
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby HPW » March 19th, 2007, 6:30 am

Johnny,

Thanks for the clear words.
(We delphi programmers are all no ms-fans)
But since I also use this in my newLISP-plugin to fire the newLISP-doc I have no control over the installed browser on other PC's.
So I search a method to offer this function even there.

Kambiz,

Thanks for the hint in the right direction.
I made this file by hand and launch it from explorer by double-click.
Strangly does it work now from IE7 but no more for IE6 on WIN2K.
(The only 2 I have tested it on)

Seems I have to find a method to check browser version now and fire 2 alternative start-methods.
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 238
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby HPW » March 19th, 2007, 7:22 am

Hans-Peter
HPW
Moderator
Moderator
 
Posts: 238
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby HPW » March 19th, 2007, 8:18 pm

Finally I get something to work for my newlisp-plugin:

http://www.neosoftware.com/forum/viewto ... &start=150

:wink:
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 238
Joined: February 25th, 2006, 10:19 am
Location: Germany


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 7 guests

cron