DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   Watched TopicsWatched Topics     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Starting IE7 with Anchor

 
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> Delphi Programming
View previous topic :: View next topic  
Author Message
HPW
Moderator


Joined: 25 Feb 2006
Posts: 160
Location: Germany

PostPosted: 17/03/07 11:07    Post subject: Starting IE7 with Anchor Reply with quote

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_shellexecute+mit+anchor+nicht+mit+ie7.html


Code:
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
Back to top
View user's profile Send private message
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1231
Location: Tehran, Iran

PostPosted: 17/03/07 12:29    Post subject: Reply with quote

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

By the way, to lunch IE you do not need more than one line of code.
Code:
ShellExecute(0, 'open', PChar(URL), nil, nil, SW_SHOW);

_________________
Kambiz

Back to top
View user's profile Send private message Send e-mail Visit poster's website
HPW
Moderator


Joined: 25 Feb 2006
Posts: 160
Location: Germany

PostPosted: 17/03/07 21:05    Post subject: Reply with quote

>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
Back to top
View user's profile Send private message
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1231
Location: Tehran, Iran

PostPosted: 18/03/07 16:48    Post subject: Reply with quote

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.

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

Back to top
View user's profile Send private message Send e-mail Visit poster's website
HPW
Moderator


Joined: 25 Feb 2006
Posts: 160
Location: Germany

PostPosted: 18/03/07 20:09    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Johnny_Bit
Administrator


Joined: 15 Jun 2003
Posts: 397

PostPosted: 18/03/07 22:35    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1231
Location: Tehran, Iran

PostPosted: 18/03/07 23:48    Post subject: Reply with quote

Sorry! I'm getting old. Smile

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:
[InternetShortcut]
URL=file:///c:/Programme/newLISP/newlisp_manual.html#setq

_________________
Kambiz

Back to top
View user's profile Send private message Send e-mail Visit poster's website
HPW
Moderator


Joined: 25 Feb 2006
Posts: 160
Location: Germany

PostPosted: 19/03/07 06:30    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
HPW
Moderator


Joined: 25 Feb 2006
Posts: 160
Location: Germany

PostPosted: 19/03/07 07:22    Post subject: Reply with quote

One method is here:

http://www.swissdelphicenter.ch/de/showcode.php?id=397

_________________
Hans-Peter
Back to top
View user's profile Send private message
HPW
Moderator


Joined: 25 Feb 2006
Posts: 160
Location: Germany

PostPosted: 19/03/07 20:18    Post subject: Reply with quote

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

http://www.neosoftware.com/forum/viewtopic.php?t=10119&start=150

Wink

_________________
Hans-Peter
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> Delphi Programming All times are GMT
Page 1 of 1

Add to favorites

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group