Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Equal Sign in URL causes problems when using ShellExecute

Posted on 2004-07-30
3
436 Views
Last Modified: 2010-04-05
I typically use the following statement to launch a new instance of an Internet Explorer browser pointed to a specific URL address (strURL):

ShellExecute(Application.MainForm.Handle, 'open', 'explorer.exe', PChar(strURL), nil, SW_SHOW);

In most cases this works fine, however I have come across a case that does not work.
If the URL contains an equal sign in the URL string, the browser will not load and I get the following error message:
"The path 'test' does not exist or is not a directory. "

In the above case the particular strURL contains the following string:
strURL := 'http://www.google.com/groups?as_q=test';

It appears that the equal sign is causing the string to be divided perhaps.
I've tried substituting %3D in place of the equal sign with no success.
I would appreciate any help anyone could offer.

Thanks,
ilmds123
0
Comment
Question by:ilmds123
  • 2
3 Comments
 
LVL 4

Expert Comment

by:JeePeeTee
ID: 11680631
some character are not allowed. make use of this routine to solve your url problem

function URLEncode(const ASrc: string): string;
var
  i: Integer;
begin
  Result := '';
  for i := 1 to Length(ASrc) do
  begin
    if ASrc[i] = ' ' then
    begin
      Result := Result + '+';
    end else if NOT (ASrc[i] in ['A'..'Z', 'a'..'z', '0'..'9']) then
    begin
      Result := Result + '%' + IntToHex(Ord(ASrc[i]), 2);
    end else
    begin
      Result := Result + ASrc[i];
    end;
  end;
end;
0
 
LVL 4

Accepted Solution

by:
JeePeeTee earned 500 total points
ID: 11680739
Forgot my 1st mail....

but make use of " arround your string so.....

strURL:= '"http://www.google.com/groups?as_q=test"';

... that it will solve your problem.
0
 

Author Comment

by:ilmds123
ID: 11680784
JeePeeTee,

The missing quotes was the problem. Thanks so much!

ilmds123
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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