如何根据恢复值保存/恢复窗口位置和更新GUI [英] How to save/restore windows position and update GUI as per restore values

查看:106
本文介绍了如何根据恢复值保存/恢复窗口位置和更新GUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用下面的代码来存储/恢复窗口大小,但gui没有记住屏幕大小。

I have used below code for stor/resore the window size but gui is not getting remembered the screen size .

注意:在使用bloew方法本身屏幕位置之前是记住正确,但屏幕尺寸不记得

note:before using the bloew method itself screen position is remembering correctly but screen size not remembering




void CMainFrame :: OnDestroy()

{

  

    WINDOWPLACEMENT wp,wp2;



    //保存窗口位置

    GetWindowPlacement(& wp);



    WritePrivateProfileStruct(TEXT(" Section1"),zh&b $ b        TEXT(" FirstKey"),

         LPBYTE(& wp),

        sizeof(wp),

        TEXT(" appname.ini"));



     ; CFrameWndEx :: OnDestroy();

void CMainFrame::OnDestroy()
{
  
    WINDOWPLACEMENT wp, wp2;

    //save windows positions
    GetWindowPlacement(&wp);

    WritePrivateProfileStruct(TEXT("Section1"),
        TEXT("FirstKey"),
        LPBYTE(&wp),
        sizeof(wp),
        TEXT("appname.ini"));

    CFrameWndEx::OnDestroy();

}¥b $ b

int CMainFrame :: OnCreate(LPCREATESTRUCT lpCreateStruct)

{

    WINDOWPLACEMENT wp,wp2;

    GetPrivateProfileStruct(

        TEXT(" Section1"),

         TEXT(" FirstKey"),&
        LPBYTE(& wp2),

  ;       sizeof(wp2),

        TEXT(" appname.ini")) ;



    SetWindowPlacement(& wp2);

    if(CFrameWndEx :: OnCreate(lpCreateStruct)== -1)

       返回-1;

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    WINDOWPLACEMENT wp, wp2;
    GetPrivateProfileStruct(
        TEXT("Section1"),
        TEXT("FirstKey"),
        LPBYTE(&wp2),
        sizeof(wp2),
        TEXT("appname.ini"));

    SetWindowPlacement(&wp2);
    if (CFrameWndEx::OnCreate(lpCreateStruct) == -1)
        return -1;

返回0;

}




}

请告诉我这里有什么问题

could you please tell me if anything wrong here

推荐答案

哪个Windows?哪个VS?

Which Windows? Which VS?

你应该知道,例如Windows 10可以在用户配置文件中保存大型机的位置和大小,并且主机会自动更改回此大小和位置。

You should know, that e.g. Windows 10 saves the position and size of your mainframe in the user profile, and mainframe changes back to this size and position automatically.


这篇关于如何根据恢复值保存/恢复窗口位置和更新GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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