我做了个MFC DLL 这个DLL主要功能是用来做虚拟桌面的! 就像LINUX那种 点下可以切换一个桌面但是问题是 我点击后 一刷新 程序不在了 恢复桌面的代码都在退出后才恢复 这样就郁闷了 一切换桌面我现在啥都不能做了
这就是问题所在 我想问下大家都是怎么解决的?刷新后调用ShowWindow 可以不?  还有 我看代码中 调试的时候 每次切换窗口都会进入void CDummyDeskTopDlg::OnWindowPosChanging( WINDOWPOS* lpwndpos )
{
RECT rcScrn;
SystemParametersInfo (SPI_GETWORKAREA, 0, &rcScrn, 0); // Snap X axis
if (abs(lpwndpos->x - rcScrn.left) <= m_nEdgeSnapGap)
lpwndpos->x = rcScrn.left;
else if (abs(lpwndpos->x + lpwndpos->cx - rcScrn.right) <= m_nEdgeSnapGap)
lpwndpos->x = rcScrn.right - lpwndpos->cx; // Snap Y axis
if (abs(lpwndpos->y - rcScrn.top) <= m_nEdgeSnapGap)
lpwndpos->y = rcScrn.top;
else if (abs(lpwndpos->y + lpwndpos->cy - rcScrn.bottom) <= m_nEdgeSnapGap)
lpwndpos->y = rcScrn.bottom - lpwndpos->cy;

}这段代码是不是保持窗口一直存在得到代码? abs 是啥函数关键是 OnWindowPosChanging 这个消息又是什么呢?

解决方案 »

  1.   

    abs()取绝对值
    WM_WINDOWPOSCHANGING消息
    The framework calls this member function when the size, position, or Z-order is about to change as a result of a call to the SetWindowPos member function or another window-management function. lz都不看MSDN吗?
      

  2.   

    /* ABS.C: This program computes and displays
     * the absolute values of several numbers.
     */#include  <stdio.h>
    #include  <math.h>
    #include  <stdlib.h>void main( void )
    {
       int    ix = -4, iy;
       long   lx = -41567L, ly;
       double dx = -3.141593, dy;   iy = abs( ix );
       printf( "The absolute value of %d is %d\n", ix, iy);   ly = labs( lx );
       printf( "The absolute value of %ld is %ld\n", lx, ly);   dy = fabs( dx );
       printf( "The absolute value of %f is %f\n", dx, dy );
    }
    Output
    The absolute value of -4 is 4
    The absolute value of -41567 is 41567
    The absolute value of -3.141593 is 3.141593