Solved

CWnd is transparent

Posted on 2012-03-10
3
835 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create a log table of all deleted records Sql Server 2008? 5 77
Slow process to read Excel 15 148
Trouble with References... 5 63
Shared files and folders migration 2 27
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

749 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