Solved

Threads & Winsock

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

26 Experts available now in Live!

Get 1:1 Help Now