Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CWnd is transparent

Posted on 2012-03-10
3
Medium Priority
?
862 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared 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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

715 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