我在VC7下中SetLayeredWindowAttributes()函数,打"("的时候也有函数参数提示当编译的时候报错:其未声明..请多指教,谢谢

解决方案 »

  1.   

    #ifndef WS_EX_LAYERED
    #define WS_EX_LAYERED           0x00080000
    #define LWA_COLORKEY            0x00000001
    #define LWA_ALPHA               0x00000002// Preparation for the function we want to import from USER32.DLL
    typedef BOOL (WINAPI *lpfnSetLayeredWindowAttributes)(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);lpfnSetLayeredWindowAttributes SetLayeredWindowAttributes;// Here we import the function from USER32.DLL
    HMODULE hUser32 = GetModuleHandle(_T("USER32.DLL"));
    SetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes)GetProcAddress(hUser32, "SetLayeredWindowAttributes");void CXXXXDlg::ToggleTransparency(HWND hWnd)
    {
    SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE)^WS_EX_LAYERED);
    SetLayeredWindowAttributes(hWnd,RGB(0,0,0),m_slider.GetPos(),LWA_ALPHA);}