Solved

Equal Sign in URL causes problems when using ShellExecute

Posted on 2004-07-30
3
431 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

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

914 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

15 Experts available now in Live!

Get 1:1 Help Now