我想要的程序是看起来“贴”在桌面上,有点象便条。是不能在最上面的,只能在最底层。
就是那个天气预报秀的效果.

解决方案 »

  1.   

    使用SetParent()将Parent窗口设置成GetDesktopWindow()?
      

  2.   

    用spy++看看
    我记得桌面句柄不是GetDesktopWindow获得的
      

  3.   

    感觉要hook显示桌面的消息才能做到,QQ有这样的功能
      

  4.   


    HWND hDesktop = ::FindWindow("Progman", NULL);
    hDesktop = ::GetWindow(hDesktop, GW_CHILD);
    CWnd* pWndDesktop = CWnd::FromHandle(hDesktop);
    this->SetParent(pWndDesktop);这段代码 我试过了 可以
      

  5.   

    http://blog.csdn.net/Jim3/archive/2008/02/28/2128274.aspx
      

  6.   

    to tigerMayDo:我怎么不可以呢?将上面4句放在OnInitDialog里面,看到:HWND hDesktop = ::FindWindow(L"Progman", NULL);  // hDesktop == 0x000100ec
    hDesktop = ::GetWindow(hDesktop, GW_CHILD);//  hDesktop == 0x00000000
      

  7.   

    hDesktop = ::GetWindow(hDesktop, GW_CHILD);
    这句去掉看看
      

  8.   

    启动一个定时器 在定时器中不断重置
      ::SetWindowPos(GetSafeHwnd(), HWND_TOPMOST, 0, 0, 0, 0,
        SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW);
      

  9.   


    HWND hDesktop = ::FindWindow(_T("Progman"), NULL);
      hDesktop = ::GetWindow(hDesktop, GW_CHILD);
      ::SetParent(GetSafeHwnd(), hDesktop);这样确实是可以做到
      

  10.   

    原理是对的。如果LZ是用MFC对话框的话,把CxApp::InitInstance初始化改改
    CXTestDlg dlg;
    HWND hDesktop = ::FindWindow(_T("Progman"), NULL);
    m_pMainWnd = &dlg;
    CWnd dWnd;
    dWnd.Attach(hDesktop); dlg.Create(MAKEINTRESOURCE(IDD_XTEST_DIALOG),&dWnd);
    dlg.ShowWindow(SW_SHOW);
    dWnd.Detach();
    int nResponse = dlg.RunModalLoop();
      

  11.   


    可能因为我的是WIN7吧,去掉之后也不行,没有界面了
      

  12.   


    你是大神,用了你的方法之后貌似可以了。但是也引入了问题。用了你的方法之后,用Spy++可以看到parent窗口是Progman,
    但是用
    HWND hDesktop = ::FindWindow("Progman", NULL);
    hDesktop = ::GetWindow(hDesktop, GW_CHILD);
    CWnd* pWndDesktop = CWnd::FromHandle(hDesktop);
    this->SetParent(pWndDesktop);父窗口是NULL,这是为什么呢?引入的问题是,只要我的程序启动,天气预报窗口就一直置顶了。