wpw_mfc_win_95.html

来自「VC programing」· HTML 代码 · 共 64 行

HTML
64
字号
<HTML>

<HR><A NAME=MFC_MIN_RESTORE></A>
Return to <a href="wpw_mfc_index.html#TOC">Table of Contents for this chapter</a><br> 
<H4>Subject: MSVC++ minimizing and restoring windows??</H4><PRE>
In article: <DA62xF.4Ew.0.-s@cs.vu.nl>  gregor@cs.vu.nl (Greg Sharp) writes:
> 
> I am using MSVC++ 1.00 under Windows 3.1.  The application I am writing is
> a simple SDI program.  What I want to do is let the program minimize
> its own window and lurk in the background for a while and then restore
> itself a little later on.  The MINIMIZE and RESTORE are done from a
> timer callback routine.
> 
> I have tried using CWnd::SetWindowPlacement function.  SetWindowPlacement
> always fails (returns FALSE).  So does GetWindowPlacement for that matter.

Is it possible that you've forgotten to set the 'length' field before 
calling GetWindowPlacement?  This kept me fooled for ages.  Here's a 
snippet of code which I use to maximize my app's window:

void CMainFrame::Maximize()
{
  WINDOWPLACEMENT wp;
  
  // must set the struct length BEFORE calling GetWindowPlacement
  
  wp.length = sizeof wp;

  VERIFY(GetWindowPlacement(&wp));

  wp.flags = 0;
  wp.showCmd = SW_SHOWMAXIMIZED;

  VERIFY(SetWindowPlacement(&wp));
}

Good luck

Andrew Gebbie

In article <DA62xF.4Ew.0.-s@cs.vu.nl> gregor@cs.vu.nl "Greg Sharp" writes:

>
>I am using MSVC++ 1.00 under Windows 3.1.  The application I am writing is
>a simple SDI program.  What I want to do is let the program minimize
>its own window and lurk in the background for a while and then restore
>itself a little later on.  The MINIMIZE and RESTORE are done from a
>timer callback routine.

Just call "ShowWindow"!

Chris
-- 
--------------------------------------------------------------------------
| Chris Marriott, Warrington, UK      | Author of SkyMap v2 shareware    |
| chris@chrism.demon.co.uk            | astronomy program for Windows.   |
|      For more info, see http://www.winternet.com/~jasc/skymap.html     |
|      Author member of Association of Shareware Professionals (ASP)     |
--------------------------------------------------------------------------
 
 </PRE> 

</HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?