Solved

Equal Sign in URL causes problems when using ShellExecute

Posted on 2004-07-30
3
437 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
[X]
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
  • 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

Suggested Solutions

Title # Comments Views Activity
Making delphi communicate with a c# service 16 124
LAN or WAN ? 11 106
Convert a string into a TDateTime 5 72
Multi-layered image in FireMonkey 9 68
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

733 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