Solved

CWnd is transparent

Posted on 2012-03-10
3
840 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
[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
  • 3
3 Comments
 
LVL 1

Author Comment

by:supportoranges
ID: 37705273
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
ID: 37706053
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
ID: 37706055
This worked
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and 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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

752 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