| View previous topic :: View next topic |
| Author |
Message |
HPW Moderator
Joined: 25 Feb 2006 Posts: 160 Location: Germany
|
Posted: 17/03/07 11:07 Post subject: Starting IE7 with Anchor |
|
|
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 |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1231 Location: Tehran, Iran
|
Posted: 17/03/07 12:29 Post subject: |
|
|
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: | | ShellExecute(0, 'open', PChar(URL), nil, nil, SW_SHOW); |
_________________ Kambiz
 |
|
| Back to top |
|
 |
HPW Moderator
Joined: 25 Feb 2006 Posts: 160 Location: Germany
|
Posted: 17/03/07 21:05 Post subject: |
|
|
>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 |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1231 Location: Tehran, Iran
|
Posted: 18/03/07 16:48 Post subject: |
|
|
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 |
|
 |
HPW Moderator
Joined: 25 Feb 2006 Posts: 160 Location: Germany
|
Posted: 18/03/07 20:09 Post subject: |
|
|
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 |
|
 |
Johnny_Bit Administrator
Joined: 15 Jun 2003 Posts: 397
|
Posted: 18/03/07 22:35 Post subject: |
|
|
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 |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1231 Location: Tehran, Iran
|
Posted: 18/03/07 23:48 Post subject: |
|
|
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: | [InternetShortcut]
URL=file:///c:/Programme/newLISP/newlisp_manual.html#setq |
_________________ Kambiz
 |
|
| Back to top |
|
 |
HPW Moderator
Joined: 25 Feb 2006 Posts: 160 Location: Germany
|
Posted: 19/03/07 06:30 Post subject: |
|
|
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 |
|
 |
HPW Moderator
Joined: 25 Feb 2006 Posts: 160 Location: Germany
|
|
| Back to top |
|
 |
HPW Moderator
Joined: 25 Feb 2006 Posts: 160 Location: Germany
|
|
| Back to top |
|
 |
|