Solved

I need ShellAPI help for my unit

Posted on 2001-08-31
8
423 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 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
Technology Partners: 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!

 
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

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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

623 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