Solved

CWnd is transparent

Posted on 2012-03-10
3
812 Views
Last Modified: 2012-03-10
Just trying to create an MFC CWnd window.  Do I need to derive from CWnd or can I just use a CWnd.  Anyway, window is failing to show although I know it is there because i can see it in its iconized state in the task bar and if i click it i get the outline although the inside is transparent.  I would have thought the client area would be white.  It doesn't matter if I register a class or not.  If I supply NULL for the window class the problem is the same.  Please help
      CWnd* pWnd = new CWnd;
      CString strMyClass = AfxRegisterWndClass(
      CS_VREDRAW | CS_HREDRAW,
      ::LoadCursor(NULL, IDC_ARROW),
      (HBRUSH) ::GetStockObject(WHITE_BRUSH),
      ::LoadIcon(NULL, IDI_APPLICATION));
      BOOL success= pWnd->Create(
       NULL,
         strMyClass,
       //strMyClass,
       WS_OVERLAPPED, // if the window doesn't need to be visible you don't need any styles
       CRect(0,0,300,300),
       CWnd::GetDesktopWindow(),
         //this,
       1234);
      if (success)
            pWnd->ShowWindow(SW_SHOW);
0
Comment
Question by:supportoranges
  • 3
3 Comments
 
LVL 1

Author Comment

by:supportoranges
Comment Utility
I guess the window isn't transparent.  I have attached a screenshot of what i see if i Spy++ on the window.  I know I have the right one.  Why is it black?  It's like a black hole.  Please help this is driving me crazy.
forexperts.png
0
 
LVL 1

Accepted Solution

by:
supportoranges earned 0 total points
Comment Utility
CString strMyClass = AfxRegisterWndClass(
      CS_VREDRAW | CS_HREDRAW,
      ::LoadCursor(NULL, IDC_ARROW),
      (HBRUSH) ::GetStockObject(WHITE_BRUSH),
      ::LoadIcon(NULL, IDI_APPLICATION));
      BOOL success= pWnd->Create(
       strMyClass,
         "Hello",
       WS_OVERLAPPEDWINDOW, // if the window doesn't need to be visible you don't need any styles
       CRect(0,0,300,300),
       CWnd::GetDesktopWindow(),
         //this,
       1234);
      if (success)
            pWnd->ShowWindow(SW_SHOWNORMAL);
0
 
LVL 1

Author Closing Comment

by:supportoranges
Comment Utility
This worked
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

11 Experts available now in Live!

Get 1:1 Help Now