解决方案 »

  1.   

    在OnInitDialog()加入:
    //加入WS_EX_LAYERED扩展属性
    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,128,2); 
    FreeLibrary(hInst); 
    }//那个128的值就是透明的程度.
      

  2.   

    BOOL CExampleDlg::OnInitDialog()
    {
    CDialog::OnInitDialog();
    // Set the icon for this dialog.  The framework does this automatically
    //  when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE); // Set big icon
    SetIcon(m_hIcon, FALSE); // Set small icon
    // TODO: Add extra initialization here
    SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000);
    //加入WS_EX_LAYERED扩展属性
    HINSTANCE hInst = LoadLibrary("User32.DLL"); 
    if(hInst) 

    typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD); 
    MYFUNC fun = NULL;
    fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");
    //取得SetLayeredWindowAttributes函数指针 
    if(fun)fun(this->GetSafeHwnd(),0,129,2); 
    FreeLibrary(hInst); 
    }
    return TRUE;  // return TRUE  unless you set the focus to a control
    }
      

  3.   

    在win98中除了自己画,其他方法没有SetLayeredWindowAttributes和WS_EX_LAYERED这两个东西从win2000才开始支持。
      

  4.   

    SetLayeredWindowAttributes  Windows NT/2000/XP: Included in Windows 2000 and later.
      Windows 95/98/Me: Unsupported.
      Header: Declared in Winuser.h; include Windows.h.
      Library: Use User32.lib.