Link to home
Start Free TrialLog in
Avatar of mchen2
mchen2

asked on

Pop-up window style.

I am developing an application which can pop up another  window when a button on the main window is clicked. I used the CFrameWnd member function LoadFrame(nResID, WS_OVERLAPPEDWINDOW, NULL, &context). The problem is that the popped up window is always on top, even if it is inactive. I tried other window styles, but they are either still always on top or do not show up at all. Is there any way to solve the problem? By the way, how to set the size of the popped up window. I do not want to use the default size. I want it smaller when it is popped up.
Avatar of dujie
dujie

The first question: You don't use the LoadFrame fuction.
second question:
  You can use CWnd::PreCreateWindow function,It is called by the framework before the creation of the Windows window attached to this CWnd object.


Avatar of mchen2

ASKER

In LoadFrame fuction the context is an instance of CCreateContext. It associates the View with the Frame and the Document. If I do not use the LoadFrame function, how can I associate the View with the Frame and the Document?
How to use CWnd::PreCreateWindow function?

Could you give me some sample code?
Avatar of mchen2

ASKER

Adjusted points to 30
Avatar of mchen2

ASKER

Adjusted points to 50
Avatar of mchen2

ASKER

Adjusted points to 80
Why don't you try using a modeless dialog box and passing it a reference to your view/document?
DO remember to remove WS_EX_TOOLWINDOW from its style.
In your PreCreateWindow(), set its size as you want.
Avatar of mchen2

ASKER

Hi, Mr. Speedup,

How to remove WS_EX_TOOLWINDOW?

How to set the size of the window in PreCreateWindow()?
Avatar of mchen2

ASKER

I withdraw the first question.

Now the question is:

How to set the size and the title of the window in PreCreateWindow()?
ASKER CERTIFIED SOLUTION
Avatar of payn
payn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mchen2

ASKER

Thanks.

I tried your approach. The problems are:

1. cs.hwndParent = NULL; statement causes assertion failure.
2. cs.lpszName = "Falco Lives!"; statement does not work. (The frame is a CChildFrame, not a top-level window)
3. cs.cx = cs.cx/2; statement does dot work.
I guess I did not make the question clear. This is a MDI application. I want to set the child window's style.