使用Windows API 函数 FindWindow 找到要刷新的窗口的句柄,用 PostMessage 函数发消息给此窗口。

解决方案 »

  1.   

    找到Desktop 的hWnd
    BOOL InvalidateRect(    HWND hWnd, // handle of window with changed update region  
        CONST RECT *lpRect, // address of rectangle coordinates 
        BOOL bErase // erase-background flag 
       );
      

  2.   

    你是要刷新界面还是系统?这是两个不同的范畴,刷新界面,Rabbit的方法够了。刷新系统请用函数SHChangeNotify,例如刷新系统的文件关联:
    SHChangeNotify(SHCNE_ASSOCCHANGED,SHCNF_IDLIST+SHCNF_FLUSH,nil,nil);
    具体的你看帮助!很详细的。
      

  3.   

    调用InvalidRect API函数就可以了,把其中的句柄设成要刷新的窗口句柄,0就是桌面。
      

  4.   

    我的目的就是要刷新桌面的背景:
    我用了Invalidaterect(0,nil,true)orInvalidaterect(0,nil,False)
    都不行,请指教!
      

  5.   

    不要用0,你用GetDesktopWindow取得桌面窗口的句柄!很多API可以使用0作为参数,但是有可能出现问题,这个0不知道害死了多少人!
      

  6.   

    Invalidaterect(GetDesktopWindow,nil,true)
    Invalidaterect(GetDesktopWindow,nil,False)