Solved

API fuctions troubles

Posted on 1998-10-28
4
169 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
  • 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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 remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now