Solved

HDC mess

Posted on 1997-05-13
1
318 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
[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:
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…
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…

623 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