?
Solved

I need ShellAPI help for my unit

Posted on 2001-08-31
8
Medium Priority
?
425 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
[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
8 Comments
 
LVL 15

Accepted Solution

by:
NickRepin earned 400 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Industry Leaders: 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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

719 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