Solved

API fuctions troubles

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

740 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