Solved

I need ShellAPI help for my unit

Posted on 2001-08-31
8
418 Views
Last Modified: 2010-05-18
I have a small unit 'ExeMod.pas' and in the Initialization section I have code like this


initialization
begin
ShellExecute(Handle, 'open', PChar('My.exe'), PChar('-a'), nil, SW_SHOW);
end;
end.

I put ShellAPI in the unit's uses clause
but when I try to run a program that uses
ExeMod.pas I get this error

Undeclared identifier 'Handle'

what silly little thing am I forgetting to do...or what am I doing wrong?
:-)
0
Comment
Question by:Gwena
8 Comments
 
LVL 15

Accepted Solution

by:
NickRepin earned 100 total points
ID: 6447231
Looks like you don't need the Handle at all. Use 0 or nil instead.
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6447242
seems that you don't use forms, so the contorl unit not included in the uses clause
0
 
LVL 5

Author Comment

by:Gwena
ID: 6447252
Hi :-)

 adding control to the uses does not help :-(
 setting Handle to 0 does seem to work :-)

But It's late and I'm groggy (must be that long island tea that guy got me :-)

I will check out using 0 to replace Handle a bit more in the morning :-)
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 17

Expert Comment

by:inthe
ID: 6447266
just to add ,used in the usual delphi context
(ie in some procedure of a form) "handle"  would refer to the form1.handle property

for instance

procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(inttostr(handle));
showmessage(inttostr(form1.Handle));
end;

would both show same result
so to use a 0 a nick said will be fine

 from win32 help about the hwnd param of shellexecute:
This window receives any message boxes that an application produces. For example, an application may report an error by producing a message box.

if that functionality was needed you would probably use createprocess anyway..
0
 

Expert Comment

by:d32coder
ID: 6447686
Try using
Application.Handle
instead.

Don
0
 
LVL 5

Author Comment

by:Gwena
ID: 6447784


  Your solution works fine... so here's your points
Thanks a bunch :-)
0
 
LVL 5

Author Comment

by:Gwena
ID: 6447792
Hi inthe
  Thanks for the extra info about handles... handles still seem a bit mysterious to me :-)
0
 
LVL 5

Author Comment

by:Gwena
ID: 6447796
Hi d32coder

 Application.handle seems to work fine as well... thanks for the info :-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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 use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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