我使用了LockWindowUpdate(GetDesktopWindow());但是我的程序更本锁不住桌面。
怎样才能锁住桌面呢?

解决方案 »

  1.   

    GetDesktopWindow()并没有得到你看到的“桌面”的窗口
    建议用spy++看看
      

  2.   

    GetDesktopWindow()当然是桌面句柄,不过这个句柄在SPY++中是不允许查看的。
      

  3.   

    既然你认为GetDesktopWindow()能得到桌面窗口句柄,那为什么锁不了呢?
    还有你的spy++是什么版本,为什么我的就可以看桌面?
    你有比较过spy++得到的桌面的handle和用GetDesktopWindow()得到handle的值吗?
    无语
      

  4.   

    最后说一句,LockWindowUpdate()的返回值MSDN里是这样说的
    --------------------------------------------------------------------------------
    If the function succeeds, the return value is nonzero.If the function fails, the return value is zero, indicating that an error occurred or another window was already locked. ----------------------------------------------------------------------------------
    如果你返回值为true,那可以肯定GetDesktopWindow()并没有得到你所谓的“桌面”的句柄,
    要想获得桌面窗口,比较保险的方法是用
    CWnd* pDesktop = CWnd::FindWindow("Progman","Program Manager")来得到,不信的话,你可以用::ShowWindow(pDesktop->GetSafeHwnd(),SW_HIDE)看看桌面图标是否隐藏了
      

  5.   

    FindWindow("Progman","Program Manager")得到的是程序管理器的窗口,你隐藏的只的桌面图标,并不是整个桌面。