Link to home
Start Free TrialLog in
Avatar of Yoni
Yoni

asked on

API fuctions troubles

I am using some API functions with no problems. I just type them and delphi recognizes the and their syntax. But when I try to use other functions they won't work. For instance Winexe is a function that delphi 4 recognizes but when I try to use shellexecute and I do the syntax right I get an "undeclared identifier "ShellExecute" error. Can anyone tell me what's the problem and how to solve it?
Thanks!
ASKER CERTIFIED SOLUTION
Avatar of dwwang
dwwang

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
Avatar of Yoni
Yoni

ASKER

I have found the unit and added it to the project and still doesn't work
No, I mean in the unit you are calling the API, you must add shellapi in your USES list.

i.e.
uses xxx,xxx,...,shellapi

and you needn't add it to your project -- actually you'd better remove it from your project, Delphi can find it automatically.
That's because you have a wrong syntax.. Here is the right syntax for using the the ShellExecute()

ShellExecute(0, 'open', 'C:\windows\desktop\test.txt', nil, nil, SW_NORMAL);

Cheers,
Viktor