Solved

HDC mess

Posted on 1997-05-13
1
311 Views
Last Modified: 2013-12-04
i have a HDC i'm working with.
i do WindowFromDC and get a HWND. then after a while
if i do again WindowFromDC on the same HDC. i get a
different HWND then the previous.
in between the two actions i mostly draw and sometime
create a memhdc and release it. i don't have more then 2
HDC at a time so there is probably no error of overwriting
the HDC and besides the only thing that is changed is the HWND
0
Comment
Question by:cyclop
1 Comment
 
LVL 1

Accepted Solution

by:
lwiding earned 100 total points
ID: 1397322
A lot depends on the window class styles and how you got the HDC you are using. If the window you got it from has the CS_CLASSDC style set, and another window of that class did a GetDC() after you first called WindowFromDC(), than the second call you made to WindowFromDC shold return the second window's handle.

If you are not using the CS_CLASSDC flag, than perhaps you could show the code you use to get the HDC, and the code that is seeing this problem. Remember, if you are using GetDC() to get the HDC, the handle should not be used after ReleaseDC() is called.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 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

17 Experts available now in Live!

Get 1:1 Help Now