Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

I need ShellAPI help for my unit

Posted on 2001-08-31
8
Medium Priority
?
426 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 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

926 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