最近遇到这个问题,Win7下UAC开启时窗口就无法响应WM_DROPFILES消息,上网搜了原因,并且将在代码上放行了DROPFILES和COPYGLOBALDATA消息。
可是在用Spy++抓窗口的消息在UAC开启的情况下还是没有抓到(关闭UAC时可以抓到功能正常),请问下有没有其它的什么原因会导致这种现象?如何解决?AllowMeesageForVistaAbove( WM_DROPFILES, TRUE );
AllowMeesageForVistaAbove( 0x0049, TRUE ); // 0x0049 - WM_COPYGLOBALDATA
bool CXXX::AllowMeesageForVistaAbove( WM_DROPFILES, TRUE )
{
typedef BOOL (WINAPI* _ChangeWindowMessageFilter)( UINT, DWORD );
HMODULE hUserMod = NULL;
BOOL bResult = FALSE;
hUserMod = LoadLibrary( "user32.dll" );
if ( hUserMod == NULL )
{
return FALSE;
} _ChangeWindowMessageFilter pChangeWindowMessageFilter = (_ChangeWindowMessageFilter)GetProcAddress( hUserMod, "ChangeWindowMessageFilter" );
if ( NULL == pChangeWindowMessageFilter )
{
FreeLibrary( hUserMod );
return FALSE;
} bResult = pChangeWindowMessageFilter( uMessage, bAllow ? 1 : 2 ); // 1-MSGFLT_ADD, 2-MSGFLT_REMOVE
if( NULL != hUserMod )
{
FreeLibrary( hUserMod );
}
return bResult;
}
可是在用Spy++抓窗口的消息在UAC开启的情况下还是没有抓到(关闭UAC时可以抓到功能正常),请问下有没有其它的什么原因会导致这种现象?如何解决?AllowMeesageForVistaAbove( WM_DROPFILES, TRUE );
AllowMeesageForVistaAbove( 0x0049, TRUE ); // 0x0049 - WM_COPYGLOBALDATA
bool CXXX::AllowMeesageForVistaAbove( WM_DROPFILES, TRUE )
{
typedef BOOL (WINAPI* _ChangeWindowMessageFilter)( UINT, DWORD );
HMODULE hUserMod = NULL;
BOOL bResult = FALSE;
hUserMod = LoadLibrary( "user32.dll" );
if ( hUserMod == NULL )
{
return FALSE;
} _ChangeWindowMessageFilter pChangeWindowMessageFilter = (_ChangeWindowMessageFilter)GetProcAddress( hUserMod, "ChangeWindowMessageFilter" );
if ( NULL == pChangeWindowMessageFilter )
{
FreeLibrary( hUserMod );
return FALSE;
} bResult = pChangeWindowMessageFilter( uMessage, bAllow ? 1 : 2 ); // 1-MSGFLT_ADD, 2-MSGFLT_REMOVE
if( NULL != hUserMod )
{
FreeLibrary( hUserMod );
}
return bResult;
}
希望对你有帮助
上次忘附网址了
http://archive.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=cwmfex&ReleaseId=1846
ASSERT( pInfo->IsKindOf( RUNTIME_CLASS( COleDropInfo ) ) );
UINT format = RegisterClipboardFormat( CONTACT_DATA_FORMAT );
if( pInfo->m_pDataObject->IsDataAvailable( format ) )
{
return DROPEFFECT_COPY;
}
else
{
return DROPEFFECT_NONE;
}
消息没有被Post给OnDropFiles( WPARAM wParam, LPARAM lParam ),
但是在XP下一切正常,请问这竟然是什么原因呢