Solved

Threads & Winsock

Posted on 1997-03-12
1
387 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now