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?
Who is Participating?
dwwangConnect With a Mentor Commented:
You must use ShellApi unit to run Shellexecute;

Try to find the source unit before you call an API function.
YoniAuthor Commented:
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.

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);

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.