Solved

Threads & Winsock

Posted on 1997-03-12
1
402 Views
Last Modified: 2010-04-03
My application locks up when I use DeAllocateHwnd() in a
thread.  I have used AllocateHwnd() to start with, which seems to work fine.  But when I DeAllocate the window handle, it crashes the program and most times win95.
The thread is being used for winsock applications.
0
Comment
Question by:spookie031297
1 Comment
 
LVL 1

Accepted Solution

by:
ozzy earned 50 total points
ID: 1334850
The correct use of AllocateHwnd() is
function AllocateHWnd(Method: TWndMethod): HWND;
I assume you are using it like...
handle := AllocateHwnd(method);
then DeAllocating it by doing...
DeallocateHWnd(Handle);
If this is correct (your using Handle is both), make sure you do not assign Handle to anything else before deallocating it, and make sure that the value of it does not change.
A good way to test this is to allocate it, then deallocate it on the next line as you step through your code in debug mode.  See if it crashes then, if not, wlak through your entire code watching to see if Handle changes.
Also make sure that any child windows of this window are destroyed prior to destroying the parent window.
If you are getting an Exception, include the name of the exception and any additional info in your responce.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
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…

679 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