Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ShellExecute "access is denied"

Posted on 2007-10-09
9
Medium Priority
?
1,852 Views
Last Modified: 2008-02-21
I am calling ShellExecute but it always returns "access is denied" and I am not sure why.

src:='http://finance.yahoo.com/';
result:=ShellExecute(Application.handle,nil,pchar(src),nil,nil,SW_SHOWNORMAL);
0
Comment
Question by:DSOM
9 Comments
 
LVL 18

Expert Comment

by:Johnjces
ID: 20045942
What operating system are you using? Vista?

John
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 20046033
what context are you running this under? eg. are you running it inside a service, or with only "Local System" user rights?
0
 

Author Comment

by:DSOM
ID: 20050584
The OS is WindowsXP and the context is a usermode application.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:Steven-Fernandez
ID: 20088985
Try and see if this works for you instead.

ShellExecute(self.WindowHandle,'open','http://finance.yahoo.com/',nil,nil, SW_SHOWNORMAL);
0
 
LVL 5

Expert Comment

by:Steven-Fernandez
ID: 20476758
If the above still does not work ... try to run your application as an Administrator and see what happens.
0
 

Author Comment

by:DSOM
ID: 20479800
It seems to launch ok with firefox as the default browser but not with internet explorer
0
 

Author Comment

by:DSOM
ID: 20482822
The problem seems to occur on a machine that either has no default browser or the shell api is unable to locate the default browser.  I set up an alternate method to call IE directly in such a case and it seems to work.

...
begin
  alt:='C:\Program Files\Internet Explorer\iexplore.exe '+src;
  result:=ShellExecute(Application.handle,nil,pchar(src),nil,nil,SW_SHOWNORMAL);
  if (result = 5) then //access denied
    result:=winexec(pchar(alt), sw_shownormal);

Open in new window

0
 
LVL 5

Accepted Solution

by:
Steven-Fernandez earned 375 total points
ID: 20762509
So are you sorted now?

You can also check: HKEY_CLASSES_ROOT\.html\(Default)  /  HKEY_CLASSES_ROOT\.htm\(Default) and HKEY_CLASSES_ROOT\htmlfile\shell\open\command and see if there is something wrong at those locations where the default browsers are set.

0
 
LVL 5

Expert Comment

by:Steven-Fernandez
ID: 20762532
Finally, if none of that works try installing all Internet explorer patches so it's all up to date and try again. If all that goes wrong let us know.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

810 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