zoukankan      html  css  js  c++  java
  • VC++小结(一)

    几个获取尺寸的函数:

     

     

    GetClientRect()--------

    获得客户区坐标,

    相对于窗口左上角,

    不包括标题栏,

    所以

     

    left 

     

    top 

    值始终是

     

    0

     

     

    GetWindowRect

    ()

    ---------

    相对于屏幕左上角的坐标;

     

     

    GetSystemMetrics

    ()

    ---------

    其中的

     

    SM_CXFRAME 

    表示边框的水平厚度,

    SM_CXSIZE 

     

    示标题栏的宽度,也即关闭按钮的宽度。

     

    (一)几个获取尺寸的函数:  
      1、GetClientRect()--------获得客户区坐标,相对于窗口左上角,不包括标题栏,所以 left 和 top 值始终是 0;  
      2、GetWindowRect()---------相对于屏幕左上角的坐标;  
      3、GetSystemMetrics()---------其中的 SM_CXFRAME 表示边框的水平厚度,SM_CXSIZE 表 示标题栏的宽度,也即关闭按钮的宽度。 

      

    (二)判断窗口是否是最大化 

    WINDOWPLACEMENT wndpl;
    GetWindowPlacement(&wndpl);
    if(wndpl.showCmd == SW_SHOWMAXIMIZED)
    {
              //最大化...
    }

    (三)对话框的关闭

    1、关闭对话框 AfxGetMainWnd()->DestroyWindow();

    2、对话框窗口对象调用CloseWindow(),窗口是关闭了,但是进程还在(任务管理器里结束进程)。

    3、exit(0); 对象调用PostQuitMssage(0);   退出程序, 所有窗体也就关闭了

      

    (四)获取控件的指针 

    GetDlgItem(控件ID):返回该控件的指针

    CWnd::EnableWindow(布尔值):True使控件可用,False则禁用控件。

    (五)获取窗口的句柄 

    GetSafehWnd   取你程序所在窗口类的句柄  
    GetActiveWindow   取当前活动窗口句柄  
    AfxGetMainWnd   取主窗口句柄  
    GetForegroundWindow   取前台窗口句柄

  • 相关阅读:
    LeetCode 252. Meeting Rooms
    LeetCode 161. One Edit Distance
    LeetCode 156. Binary Tree Upside Down
    LeetCode 173. Binary Search Tree Iterator
    LeetCode 285. Inorder Successor in BST
    LeetCode 305. Number of Islands II
    LeetCode 272. Closest Binary Search Tree Value II
    LeetCode 270. Closest Binary Search Tree Value
    LeetCode 329. Longest Increasing Path in a Matrix
    LintCode Subtree
  • 原文地址:https://www.cnblogs.com/hhj-321/p/3338087.html
Copyright © 2011-2022 走看看