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
Solved

HDC mess

Posted on 1997-05-13
1
315 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Save copy of document in Word 4 88
MSDN Subscription - Azure and NFP's 3 75
Visual Studio 2015 locks debug executable 9 214
Where does legacy ASP.NET initialize language? 2 22
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 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