Solved

Equal Sign in URL causes problems when using ShellExecute

Posted on 2004-07-30
3
430 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
Comment Utility
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
Comment Utility
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
Comment Utility
JeePeeTee,

The missing quotes was the problem. Thanks so much!

ilmds123
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

8 Experts available now in Live!

Get 1:1 Help Now