Solved

why won't destroywindow work?

Posted on 2000-03-10
3
179 Views
Last Modified: 2010-04-04
I can't get the API call destroywindow to work and i have to use a call like it because i am not dealing with a process.... i keep getting error 216.

Any help would be much appreciated, i'll increase the points on the question when i get some more.
0
Comment
Question by:frangers99
[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
3 Comments
 
LVL 2

Accepted Solution

by:
craig_capel earned 5 total points
ID: 2604065
//destroywindow
//sendmessage(form1.handle,wm_destroy,0,0);
sendmessage(form1.handle,wm_close,0,0);


Intresting.... I invoked destroy window like this, and watch the icon in the top left corner as you use wm_destroy....

You can use Sendmessage to close the window or you can do this....

var
wnd2 : hwnd;
ProcessID,cpid : Cardinal;
begin
wnd2:=findwindow('Shell_TrayWnd',nil); //handle of window

ProcessID := GetWindowThreadProcessID(wnd2,@cpid);
TerminateProcess(OpenProcess(PROCESS_TERMINATE,false,cpid),1);
end;

Ok... hope thats worth 5 points :)
0
 

Author Comment

by:frangers99
ID: 2604083
Craig you are an absolute champion, sendmessage(form1.handle,wm_close,0,0);
 worked perfectly, finally...i spent so long trying to figure that out, you get the 5 points. You might have spotted my other message with a similar title....
it's pretty similar if you can work out the second part then i spose i owe you 175 points.
0
 

Author Comment

by:frangers99
ID: 2604092
sorry i'm outta points but i'd give you 100 if i had them. This is one of the best repsonses i've seen on this experts advice thing. Thanks a heap!
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

Suggested Solutions

Title # Comments Views Activity
Delphi XE10 Round Image 2 224
Correct Component for Shopping Cart. 2 133
Delphi inherited method 6 88
Get weeknumber and year from date 4 56
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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