Link to home
Start Free TrialLog in
Avatar of rfwoolf
rfwoolfFlag for South Africa

asked on

ShellExecute returns 'Not enough actual parameters' if using SW_SHOWNORMAL

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

ASKER CERTIFIED SOLUTION
Avatar of ThievingSix
ThievingSix
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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 ?
Avatar of rfwoolf

ASKER

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.
Hitting ctrl-space just after the function ShellExecute, before the (
This should bring up the list of available functions starting with that name...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yeh that was my guess Geert. There might be another declaration of SW_SHOWNORMAL somewhere in that project.