?
Solved

Threads & Winsock

Posted on 1997-03-12
1
Medium Priority
?
416 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
[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
1 Comment
 
LVL 1

Accepted Solution

by:
ozzy earned 100 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 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