[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

How to make a CMDIChildWnd pop-up?

My application has one doc and two views. One view is used to display picture in normal size and the other view is used to display the same but zoomed picture. I hope the latter view can keep TOPMOST. But since the CMDIChildWnd cann't have a WS_POPUP style, how should I do? Thanks!
0
zhpch
Asked:
zhpch
  • 2
  • 2
1 Solution
 
piano_boxerCommented:
You need to create a new frame window class for the view. CMDIChildWnd is only designed to be a child of the main app-window.

Derive a new frame class from CMiniFrameWnd. Override PreCreateWindow of it:

BOOL CTopFrame::PreCreateWindow(CREATESTRUCT& cs)
{
    cs.dwExStyle |= WS_EX_TOPMOST;      
    return CMiniFrameWnd::PreCreateWindow(cs);
}

Theres is some problems to solve:
 1. The frame does not activate correct.
 2. There is a seperate menu in the top-most frame.
0
 
mikeblasCommented:
Your override is incorrect.  You should code:

BOOL CTopFrame::PreCreateWindow(CREATESTRUCT& cs)
{
   if (!CMiniFrameWnd::PreCreateWinodw(cs))
      return FALSE;

   cs.dwExStyle |= WS_EX_TOPMOST;
   return TRUE;
}

.B ekiM

0
 
piano_boxerCommented:
mikeblas: Hmmm. What I did works, but OK.
0
 
mikeblasCommented:

works != correct


0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now