SC_RESTORE无法正常工作 [英] SC_RESTORE is not working properly

查看:491
本文介绍了SC_RESTORE无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的MFC基于CFormView的应用程序中,我想处理

In my MFC CFormView based application, i want to handle

ON_WM_NCLBUTTONDBLCLK()

windows消息。也就是说,当用户双击

Tittle bar的对话框时,窗口需要最大化。所以我处理了上面的窗口消息。检查clickked区域是否是tittle bar或不使用iam

windows message. ie, when a user double click on
Tittle bar of the dialog, window needs to be maximise. So i handled the above window message. To check whether clickked area is tittle bar or not iam used

HTCAPTION

。为了最大化对话框,有一种称为

. To maximise the dialog there is style called

SC_MAXIMIZE

的样式。我知道这个。但我不需要这个。所以我使用CWnd :: MoveWindow函数调整窗口大小。

但是再次双击,然后窗口需要恢复。

为了那个iam处理

. i know this. but iam not need this. so that iam used CWnd::MoveWindow function for resize the window.
But again double click is happend, then window needs to be restored.
For that iam handled

OnSysCommand( UINT nID_i, LPARAM lParam )

。即iam从双OnNcLButtonDblClk函数发送

. ie iam send

::PostMessage( m_hWnd, WM_SYSCOMMAND, SC_RESTORE, 0 )

。但恢复无效。



恢复处理。

from double OnNcLButtonDblClk function. but Restore is not working.

handling of Restore.

void CTitleDoubleClickDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
    if( SC_RESTORE == nID )
    {
        CDialog::OnSysCommand(nID, lParam);
    }
    else
    {
        CDialog::OnSysCommand(nID, lParam);
    }
}





我的问题是

1.如何恢复通过使用SC_RESTORE将窗口改为之前的大小(注意:我使用了SC_MAXIMISE的MoveWindow来最大化窗口)



My question is
1. How to restore a window to its previous size by using SC_RESTORE( Note: iam using MoveWindow insted of SC_MAXIMISE for maximise the window)

推荐答案

我相信你的问题可能是你正在使用 MoveWindow()因此移动后将设置窗口的新大小。将 SC_RESTORE 命令传递给默认过程时,它没有以前的信息来恢复它。如果您的系统上已加载源代码,您应该可以通过单步执行Windows代码来检查这一点。
I believe your problem may be that you are using MoveWindow() so the new size of the window will be set after the move. When you pass the SC_RESTORE command to the default procedure, it has no previous information to restore it. You should be able to check this by stepping into the windows code if you have the source loaded on your system.


这篇关于SC_RESTORE无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆