希望有人能帮我看一下代码void CXChatDlg::FlashWindow()
{
if(! (GetWindowLong(m_hWnd, GWL_STYLE) & WS_VISIBLE))
{
ShowWindow(SW_MINIMIZE); CWnd* pParentWnd = GetTopLevelParent();
if ( HINSTANCE hUser = LoadLibrary( _T("User32") ) )
{
BOOL (WINAPI *pfnFlashWindowEx)(PFLASHWINFO pfwi);
(FARPROC&)pfnFlashWindowEx = GetProcAddress( hUser, "FlashWindowEx" );
if ( pfnFlashWindowEx )
{
FLASHWINFO pFWX;
pFWX.cbSize = sizeof(pFWX);
pFWX.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;
pFWX.uCount = 3;
pFWX.dwTimeout = 0;
pFWX.hwnd = m_hWnd;//pParentWnd->GetSafeHwnd();
(*pfnFlashWindowEx)( &pFWX );
}
FreeLibrary( hUser );
}
}
else
{
if ( GetForegroundWindow() != GetTopLevelParent() )
{
//CWnd* pParentWnd = GetTopLevelParent();
if ( HINSTANCE hUser = LoadLibrary( _T("User32") ) )
{
BOOL (WINAPI *pfnFlashWindowEx)(PFLASHWINFO pfwi); (FARPROC&)pfnFlashWindowEx = GetProcAddress( hUser, "FlashWindowEx" );
if ( pfnFlashWindowEx )
{
FLASHWINFO pFWX; pFWX.cbSize = sizeof(pFWX);
pFWX.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;
pFWX.uCount = 3;
pFWX.dwTimeout = 0;
pFWX.hwnd = m_hWnd;//pParentWnd->GetSafeHwnd(); (*pfnFlashWindowEx)( &pFWX );
}
FreeLibrary( hUser );
}
}
}
}XChatDlg.cpp(638) : error C2143: syntax error : missing ')' before '__stdcall'
XChatDlg.cpp(638) : error C2059: syntax error : ')'
XChatDlg.cpp(639) : error C2065: 'pfnFlashWindowEx' : undeclared identifier
XChatDlg.cpp(642) : error C2065: 'FLASHWINFO' : undeclared identifier
XChatDlg.cpp(642) : error C2146: syntax error : missing ';' before identifier 'pFWX'
XChatDlg.cpp(642) : error C2065: 'pFWX' : undeclared identifier
XChatDlg.cpp(643) : error C2228: left of '.cbSize' must have class/struct/union type
XChatDlg.cpp(644) : error C2228: left of '.dwFlags' must have class/struct/union type
XChatDlg.cpp(644) : error C2065: 'FLASHW_ALL' : undeclared identifier
XChatDlg.cpp(644) : error C2065: 'FLASHW_TIMERNOFG' : undeclared identifier
XChatDlg.cpp(645) : error C2228: left of '.uCount' must have class/struct/union type
XChatDlg.cpp(646) : error C2228: left of '.dwTimeout' must have class/struct/union type

解决方案 »

  1.   

    #ifndef FLASHWINFO
    typedef struct _FLASHWINFO
    {
      UINT  cbSize;
      HWND  hwnd;
      DWORD dwFlags;
      UINT  uCount;
      DWORD dwTimeout;
    } FLASHWINFO, *PFLASHWINFO;
    #endif //#ifndef FLASHWINFO
      

  2.   

    这个方法是可行的,可是pFWX.dwFlags    = FLASHW_ALL | FLASHW_TIMERNOFG;这个宏不可用了,要改成0x00000003.....
      

  3.   

    VC6
    是否是因为平台SDK包版本低无法调用USER32?
      

  4.   

    没有的值按MSDN定义一下
    http://msdn.microsoft.com/en-us/library/ms679348(v=vs.85).aspx
      

  5.   

    #ifndef FLASHWINFO
    typedef struct _FLASHWINFO
    {
      UINT cbSize;
      HWND hwnd;
      DWORD dwFlags;
      UINT uCount;
      DWORD dwTimeout;
    } FLASHWINFO, *PFLASHWINFO;
    #endif //#ifndef FLASHWINFO
    void CXChatDlg::FlashWindow()
    {
    if(! (GetWindowLong(m_hWnd, GWL_STYLE) & WS_VISIBLE))
    {
    ShowWindow(SW_MINIMIZE); CWnd* pParentWnd = GetTopLevelParent();
    if ( HINSTANCE hUser = LoadLibrary( _T("User32") ) )
    {
    BOOL (WINAPI *pfnFlashWindowEx)(PFLASHWINFO pfwi);
    (FARPROC&)pfnFlashWindowEx = GetProcAddress( hUser, "FlashWindowEx" );
    if ( pfnFlashWindowEx )
    {
    FLASHWINFO pFWX;
    pFWX.cbSize = sizeof(pFWX);
    pFWX.dwFlags = 0x00000003 | 0x0000000C ;//FLASHW_ALL | FLASHW_TIMERNOFG;
    pFWX.uCount = 3;
    pFWX.dwTimeout = 0;
    pFWX.hwnd = m_hWnd;//pParentWnd->GetSafeHwnd();
    (*pfnFlashWindowEx)( &pFWX );
    }
    FreeLibrary( hUser );
    }
    }
    else
    {
    if ( GetForegroundWindow() != GetTopLevelParent() )
    {
    //CWnd* pParentWnd = GetTopLevelParent();
    if ( HINSTANCE hUser = LoadLibrary( _T("User32") ) )
    {
    BOOL (WINAPI *pfnFlashWindowEx)(PFLASHWINFO pfwi); (FARPROC&)pfnFlashWindowEx = GetProcAddress( hUser, "FlashWindowEx" );
    if ( pfnFlashWindowEx )
    {
    FLASHWINFO pFWX; pFWX.cbSize = sizeof(pFWX);
    pFWX.dwFlags = 0x00000003 | 0x0000000C ;//FLASHW_ALL | FLASHW_TIMERNOFG;
    pFWX.uCount = 3;
    pFWX.dwTimeout = 0;
    pFWX.hwnd = m_hWnd;//pParentWnd->GetSafeHwnd(); (*pfnFlashWindowEx)( &pFWX );
    }
    FreeLibrary( hUser );
    }
    }
    }
    }