Solved

API fuctions troubles

Posted on 1998-10-28
4
175 Views
Last Modified: 2010-04-06
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!
0
Comment
Question by:Yoni
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
dwwang earned 30 total points
ID: 1344759
You must use ShellApi unit to run Shellexecute;

Try to find the source unit before you call an API function.
0
 

Author Comment

by:Yoni
ID: 1344760
I have found the unit and added it to the project and still doesn't work
0
 
LVL 4

Expert Comment

by:dwwang
ID: 1344761
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.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1344762
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
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

696 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