我想创建一个完全透明的窗口。
即可以透过此窗口实时看到此窗口下面所发生的一切,如光标闪烁、动画等。
不知如何做?

解决方案 »

  1.   

    你可以构造一个区域,中间是空的,自然就可以看到窗口下的一切(和他没关系:)然后使用SDI函数SetWindowRgn去设置。
      

  2.   

    我知道怎么做,要代码留下邮箱地址.
    我的邮箱是:[email protected]
      

  3.   

    http://www.vckbase.com/code/winview/advui/alphaw.zip
    http://www.vckbase.com/code/graphics/bitmap/TransparentWindow_demo.zip
      

  4.   

    SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,
    GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000);
    HINSTANCE hInst = LoadLibrary("User32.DLL"); 
    if(hInst) 

    typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD); 
    MYFUNC fun = NULL;
    //取得SetLayeredWindowAttributes函数指针 
    fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");
    if(fun)fun(this->GetSafeHwnd(),0,230,2); 
    FreeLibrary(hInst); 
    }
      

  5.   

    http://www.codeproject.com/bitmap/gditutorial.asp
      

  6.   

    谢谢大家,尤其是howtotell。我试过了,这个方法确实可以。
    但是这只在win2k/xp上有用。但我想让我的程序可在各个版本的windows上运行。
    有谁知道SetLayeredWindowAttributes这个API的实现原理,或有其它办法?
      

  7.   

    SetLayeredWindowAttributes这个API只有win2000以上的操作系统才支持
      

  8.   

    TransWindow   MyTransWindow;if( MyTransWindow.Create())
      MyTransWindow.Destroy();注意由于是完全透明的窗口,所以你将看不到任何窗口.best regards