Solved

ShellExecute returns 'Not enough actual parameters' if using SW_SHOWNORMAL

Posted on 2009-05-10
7
852 Views
Last Modified: 2012-05-06
Using Delphi BDS 2006, I get 'Not enough actual parameters' when compiling a ShellExecute statement, but ONLY if I use SW_SHOWNORMAL. If I pass SW_SHOW I do not get any error.
Also if I try this in a new application I don't get any problem. only in my existing application.

Here's the code:
var
  param: string;
begin
  param := 'calc';
  shellapi.ShellExecute(GetDeskTopWindow
    , 'open'
    , pChar(Param)
    , nil
    , nil
    , SW_SHOWNORMAL);
end;

Open in new window

0
Comment
Question by:rfwoolf
7 Comments
 
LVL 13

Accepted Solution

by:
ThievingSix earned 213 total points
ID: 24350934
Thats weird, the only thing I can think of is try passing 1 instead of SW_SHOWNORMAL.
0
 
LVL 12

Assisted Solution

by:rionroc
rionroc earned 75 total points
ID: 24351414
uses ShellApi;
...
...

var
  param: string;
  h: Thandle;
begin
  h:=GetDeskTopWindow;
  param := 'calc';
  ShellExecute(h, 'open', pChar(Param), nil , nil , SW_SHOWNORMAL);
end;


Cheers!
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 24351564
you could have declared a same named function with more parameters ...

what shows when press Ctrl-Space at the end of the function ?
1 of more functions ?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
LVL 13

Author Comment

by:rfwoolf
ID: 24351632
ThievingSix: Oddly enough, using 1 compiles.
rionroc: Using GetDesktopWindow unfortunatley doesn't help
Geert_Gruwez: Do you mean in the last parameter, or do you mean for example after the last bracket ) but before the semi-colon ; ? I assume you mean the last parameter. Then yes it brings up a list of constants starting with SW_SHOWNORMAL = 1.

I guess I can live with putting 1 in.

I will keep the question open though in case somebody has anything new to add.

By the way, if I try to think of anything I did to make it like this I know I changed the compile settings to 'include debug dcus' 'local symbols' etc etc. But when I took all of these off the problem persists - also in a fresh applicaiton if I enable all the debug things it doesn't give a problem.
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 24351785
Hitting ctrl-space just after the function ShellExecute, before the (
This should bring up the list of available functions starting with that name...
0
 
LVL 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 212 total points
ID: 24351798
or add the windows unit name in front of the parameter SW_SHOWNORMAL

var
  param: string;
begin
  param := 'calc';
  shellapi.ShellExecute(GetDeskTopWindow
    , 'open'
    , pChar(Param)
    , nil
    , nil
    , windows.SW_SHOWNORMAL);
end;
0
 
LVL 13

Expert Comment

by:ThievingSix
ID: 24351899
Yeh that was my guess Geert. There might be another declaration of SW_SHOWNORMAL somewhere in that project.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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
Newbie Thread Programming 1 161
Delphi XE10 Round Image 2 154
Delphi: Connect to running MS Outlook 4 118
Why  'Host Connection unavailable/Socket Error #113 No route to host' 6 52
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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

840 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