Solved

HDC mess

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 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