本人在学SDK,感觉以上俩个函数功能一样,但具体有什么区别呢?

解决方案 »

  1.   

    首先参数就不一样:)
    ///////////////////////////////////////////////
    SetWindowPos
    The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. Child, pop-up, and top-level windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order. BOOL SetWindowPos(
      HWND hWnd,             // handle to window
      HWND hWndInsertAfter,  // placement-order handle
      int X,                 // horizontal position
      int Y,                 // vertical position
      int cx,                // width
      int cy,                // height
      UINT uFlags            // window-positioning options
    );
    //////////////////////////////////////////////////////////////////////////////
    MoveWindow
    The MoveWindow function changes the position and dimensions of the specified window. For a top-level window, the position and dimensions are relative to the upper-left corner of the screen. For a child window, they are relative to the upper-left corner of the parent window's client area. BOOL MoveWindow(
      HWND hWnd,      // handle to window
      int X,          // horizontal position
      int Y,          // vertical position
      int nWidth,     // width
      int nHeight,    // height
      BOOL bRepaint   // repaint option
    );
      

  2.   

    移动窗口     调用CWnd : : SetWindowPos并指定SWP_NOSIZE标志。目的位置与父窗口有关(顶层窗口与屏幕有关)。调用CWnd : : MoveWindow时必须要指定窗口的大小。
    //Move window to positoin 100 , 100 of its parent window .
    SetWindowPos (NULL, 100 , 100 , 0 , 0 , SWP_NOSIZE |SWP_NOAORDER) 
    参数不一样。
      

  3.   

    本质上是给消息队列发送的消息不同、处理级别不同、功能不同:MoveWindow sends the WM_WINDOWPOSCHANGING, WM_WINDOWPOSCHANGED, WM_MOVE, WM_SIZE, and WM_NCCALCSIZE messages to the window.MoveWindow实际上是发消息,这个消息最终归SetWindowPos处理。SetWindowPos实现了对窗口的调整。如果谁有不同意见,请拿证据。
      

  4.   

    SetWindowPos()函数和MoveWindow()函数都可以将窗口移动到指定的位置,
    不过SetWindowPos()要比MoveWindow()的功能强大很多,用SetWindowPos函数
    不但可以移动窗口,还可以设置窗口的风格,比如总在最前.....
      

  5.   

    SetWindowPos()函数比MoveWindow()函数实现的功能多,
    个人同意tigerfox
    MoveWindow最终调用SetWindowPos处理
      

  6.   

    MoveWindow就是调SetWindowPos实现的