troubleshooting Question

why is WindowFromDC returning NULL?

Avatar of jbirk
jbirk asked on
Microsoft Development
7 Comments1 Solution2290 ViewsLast Modified:
I'm hooking the textout messages being sent, and when the text message for a disabled button is sent, calling WindowFromDC on the hdc sent in the message returns null.  This only seems to happen to me on the disabled buttons text, not all the other text.  If I use GetLastError to check what happened, it reports: "The operation completed successfully.".  What's going on? (this is on W2K system)

Example code:
BOOL  WINAPI TextOutWCallbackProc(HDC hdc, int nXStart, int nYStart, LPCWSTR lpwString, int cbCount)
HWND hwnd1;
hwnd1 = WindowFromDC(hdc);

Roshan Davis

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros