急。。关于flash右键菜单完全屏蔽 给小弟个好的方法。。最好给出代码。vc平台的。。谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在父窗口的PreTranslateMessage里面做区域判断 我以前写的CShockwaveFlash m_flash;...BOOL CFlashpanelDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if((WM_RBUTTONDOWN == pMsg->message) || (WM_RBUTTONDBLCLK == pMsg->message)) { //防止右键产生广告信息 DWORD dwPos = GetMessagePos(); CPoint point(LOWORD(dwPos),HIWORD(dwPos)); CRect rect; m_flash.GetWindowRect(&rect); int m = point.x; int n = point.y; int x = rect.left; int y = rect.right; int a = rect.top; int b = rect.bottom; if(x<=m && y>=m && a<=n && b>=n) { return TRUE; } } return CDialog::PreTranslateMessage(pMsg);} 重载PreTranslateMessage在此函数中添加if((pMsg->message == WM_RBUTTONDOWN) || (pMsg->message == WM_RBUTTONDBLCLK)){return TRUE;} 谢谢各位的帮助。不过我的事在win32平台中使用atl作容器来显示flash的。在这种情况下。又怎么做呢????我的代码如下:#import "C:\WINDOWS\system32\macromed\flash\flash.ocx" #include <atlbase.h> CComModule _Module; #include <atlwin.h> #pragma comment(lib,"atl") int WINAPI WinMain (HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){ UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(nCmdShow); MSG messages; hIns=hInstance; HANDLE hMutex = NULL; hMutex = CreateMutex(NULL, false, TEXT("emergeDesktop")); if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hMutex); return 0; } /*初始化桌面窗口*/ POINT p; p.x = GetSystemMetrics(SM_CXSCREEN); p.y = GetSystemMetrics(SM_CYSCREEN); ScreenRect.bottom=p.y; ScreenRect.right=p.x; ScreenRect.left=0; ScreenRect.top=0; ScrWorkSpace.bottom= p.y ; ScrWorkSpace.top=0; ScrWorkSpace.left=0; ScrWorkSpace.right= p.x; desktopCom.CreateDesktop(hInstance,DesktopProc,p,&ScrWorkSpace,true,true);//创建一个窗口 while (GetMessage (&messages, NULL, 0, 0)) { TranslateMessage(&messages); DispatchMessage(&messages); } if (hMutex) CloseHandle(hMutex); return (int)messages.wParam;}/*---------------------------------------------------------*桌面的消息处理函数*----------------------------------------------------------*/LRESULT CALLBACK DesktopProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam){ PAINTSTRUCT psPaint; HDC hDC; POINT pPoint; WINDOWPOS *wpPos; _bstr_t bstr; switch (uMsg) { case WM_CREATE: m_container.Create( hWnd, ScrWorkSpace, LPCTSTR("ShockwaveFlash.ShockwaveFlash.1"), WS_CHILD|WS_VISIBLE); m_container.QueryControl( __uuidof(IShockwaveFlash), reinterpret_cast<void**>(&shwaveflash) ); bstr=_bstr_t("D:\\123.swf"); if(shwaveflash==NULL) { PostQuitMessage(0); } shwaveflash->put_Movie(bstr); shwaveflash->put_AlignMode(5); shwaveflash->put_ScaleMode(3); shwaveflash->put_Menu(false); shwaveflash->Play(); /*设置桌面背景*/ SetDesktopBack(); break;。 [code]class CFlashControlWnd:public CWindowImpl<CFlashControlWnd>{ BEGIN_MSG_MAP(CFlashWnd) if (uMsg==WM_RBUTTONDOWN) { return 1; } else if (uMsg==WM_KEYDOWN || uMsg==WM_SYSKEYDOWN || uMsg==WM_KEYUP || uMsg==WM_SYSKEYUP) { HRESULT hr = pObj->TranslateAccelerator((LPMSG)m_pCurrentMsg); if (hr==S_OK) { return 1; } } else if (uMsg == WM_CHAR) { return GetAsyncKeyState(VK_CONTROL)||GetAsyncKeyState(VK_LCONTROL) || GetAsyncKeyState(VK_RCONTROL); } END_MSG_MAP()public: CComPtr<IOleInPlaceActiveObject> pObj;};class CFlashWnd : public CWindowImpl<CFlashWnd,CAxWindow>, public IDispEventImpl<1,CFlashWnd,&__uuidof(_IShockwaveFlashEvents),&__uuidof(ShockwaveFlash)>{ CFlashControlWnd m_ControlWnd;}LRESULT CFlashWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam){ LRESULT ret=DefWindowProc(); HRESULT hr = CreateControlEx(L"{D27CDB6E-AE6D-11CF-96B8-444553540000}",0,0,0,__uuidof(_IShockwaveFlashEvents), (IUnknown*)static_cast<IDispEventImpl<1,CFlashWnd,&__uuidof(_IShockwaveFlashEvents),&__uuidof(ShockwaveFlash)>*>(this) ); if (FAILED(hr)) { MessageBox("Flash插件未安装"); return -1; } hr = QueryControl(__uuidof(IShockwaveFlash),(void**)&m_pFlash); if (FAILED(hr)) { MessageBox("Flash插件未安装"); return -1; } CComPtr<IOleWindow> pWindow; QueryControl(&pWindow); if (pWindow) { HWND hWnd; if (SUCCEEDED(pWindow->GetWindow(&hWnd))) { m_ControlWnd.SubclassWindow(hWnd); QueryControl(&m_ControlWnd.pObj); } } return 0;}[/code] class CFlashControlWnd:public CWindowImpl<CFlashControlWnd>{ BEGIN_MSG_MAP(CFlashWnd) if (uMsg==WM_RBUTTONDOWN) { return 1; } else if (uMsg==WM_KEYDOWN || uMsg==WM_SYSKEYDOWN || uMsg==WM_KEYUP || uMsg==WM_SYSKEYUP) { HRESULT hr = pObj->TranslateAccelerator((LPMSG)m_pCurrentMsg); if (hr==S_OK) { return 1; } } else if (uMsg == WM_CHAR) { return GetAsyncKeyState(VK_CONTROL)||GetAsyncKeyState(VK_LCONTROL) || GetAsyncKeyState(VK_RCONTROL); } END_MSG_MAP()public: CComPtr<IOleInPlaceActiveObject> pObj;};class CFlashWnd : public CWindowImpl<CFlashWnd,CAxWindow>, public IDispEventImpl<1,CFlashWnd,&__uuidof(_IShockwaveFlashEvents),&__uuidof(ShockwaveFlash)>{ CFlashControlWnd m_ControlWnd;}LRESULT CFlashWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam){ LRESULT ret=DefWindowProc(); HRESULT hr = CreateControlEx(L"{D27CDB6E-AE6D-11CF-96B8-444553540000}",0,0,0,__uuidof(_IShockwaveFlashEvents), (IUnknown*)static_cast<IDispEventImpl<1,CFlashWnd,&__uuidof(_IShockwaveFlashEvents),&__uuidof(ShockwaveFlash)>*>(this) ); if (FAILED(hr)) { MessageBox("Flash插件未安装"); return -1; } hr = QueryControl(__uuidof(IShockwaveFlash),(void**)&m_pFlash); if (FAILED(hr)) { MessageBox("Flash插件未安装"); return -1; } CComPtr<IOleWindow> pWindow; QueryControl(&pWindow); if (pWindow) { HWND hWnd; if (SUCCEEDED(pWindow->GetWindow(&hWnd))) { m_ControlWnd.SubclassWindow(hWnd); QueryControl(&m_ControlWnd.pObj); } } return 0;} 为什么我的flash无法响应键盘消息,但能响应鼠标? ------编译这个控件报错原因-------- 如何阻止CMFCShellList双击时调用系统默认的处理程序? 求书。 求助! vc++编译的问题 对话框中得微软浏览器控件如何修改其下陷窗口风格及不出现滚动条? 哪位大侠既懂VC又懂html,帮小弟分析一个软件的上面带的几个html链接,谢谢! 在那儿能找到开发Asp的工具 有没有类似微软的写法,定义一个new[]操作 问个简单问题 像素高x像素宽x4+54 XP风格的Check Box控件的背景问题! 怎么在CString和HTREEITEM类型之间转换,小弟在线等。
...
BOOL CFlashpanelDlg::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if((WM_RBUTTONDOWN == pMsg->message) || (WM_RBUTTONDBLCLK == pMsg->message))
{
//防止右键产生广告信息
DWORD dwPos = GetMessagePos();
CPoint point(LOWORD(dwPos),HIWORD(dwPos));
CRect rect;
m_flash.GetWindowRect(&rect);
int m = point.x;
int n = point.y;
int x = rect.left;
int y = rect.right;
int a = rect.top;
int b = rect.bottom;
if(x<=m && y>=m && a<=n && b>=n)
{
return TRUE;
}
} return CDialog::PreTranslateMessage(pMsg);
}
在此函数中添加if((pMsg->message == WM_RBUTTONDOWN) || (pMsg->message == WM_RBUTTONDBLCLK))
{
return TRUE;
}
我的代码如下:
#import "C:\WINDOWS\system32\macromed\flash\flash.ocx"
#include <atlbase.h>
CComModule _Module;
#include <atlwin.h>
#pragma comment(lib,"atl")
int WINAPI WinMain (HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(nCmdShow);
MSG messages;
hIns=hInstance;
HANDLE hMutex = NULL;
hMutex = CreateMutex(NULL, false, TEXT("emergeDesktop"));
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
CloseHandle(hMutex);
return 0;
} /*初始化桌面窗口*/
POINT p;
p.x = GetSystemMetrics(SM_CXSCREEN);
p.y = GetSystemMetrics(SM_CYSCREEN);
ScreenRect.bottom=p.y;
ScreenRect.right=p.x;
ScreenRect.left=0;
ScreenRect.top=0;
ScrWorkSpace.bottom= p.y ;
ScrWorkSpace.top=0;
ScrWorkSpace.left=0;
ScrWorkSpace.right= p.x;
desktopCom.CreateDesktop(hInstance,DesktopProc,p,&ScrWorkSpace,true,true);//创建一个窗口
while (GetMessage (&messages, NULL, 0, 0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
if (hMutex)
CloseHandle(hMutex);
return (int)messages.wParam;
}/*---------------------------------------------------------
*桌面的消息处理函数
*----------------------------------------------------------*/
LRESULT CALLBACK DesktopProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
PAINTSTRUCT psPaint;
HDC hDC;
POINT pPoint;
WINDOWPOS *wpPos;
_bstr_t bstr;
switch (uMsg)
{
case WM_CREATE:
m_container.Create( hWnd, ScrWorkSpace, LPCTSTR("ShockwaveFlash.ShockwaveFlash.1"), WS_CHILD|WS_VISIBLE);
m_container.QueryControl( __uuidof(IShockwaveFlash), reinterpret_cast<void**>(&shwaveflash) );
bstr=_bstr_t("D:\\123.swf");
if(shwaveflash==NULL)
{
PostQuitMessage(0);
}
shwaveflash->put_Movie(bstr);
shwaveflash->put_AlignMode(5);
shwaveflash->put_ScaleMode(3);
shwaveflash->put_Menu(false);
shwaveflash->Play();
/*设置桌面背景*/
SetDesktopBack();
break;
。
class CFlashControlWnd:public CWindowImpl<CFlashControlWnd>
{
BEGIN_MSG_MAP(CFlashWnd)
if (uMsg==WM_RBUTTONDOWN)
{
return 1;
}
else if (uMsg==WM_KEYDOWN || uMsg==WM_SYSKEYDOWN || uMsg==WM_KEYUP || uMsg==WM_SYSKEYUP)
{
HRESULT hr = pObj->TranslateAccelerator((LPMSG)m_pCurrentMsg);
if (hr==S_OK)
{
return 1;
}
}
else if (uMsg == WM_CHAR)
{
return GetAsyncKeyState(VK_CONTROL)||GetAsyncKeyState(VK_LCONTROL) || GetAsyncKeyState(VK_RCONTROL);
}
END_MSG_MAP()
public:
CComPtr<IOleInPlaceActiveObject> pObj;
};
class CFlashWnd :
public CWindowImpl<CFlashWnd,CAxWindow>,
public IDispEventImpl<1,CFlashWnd,&__uuidof(_IShockwaveFlashEvents),&__uuidof(ShockwaveFlash)>
{
CFlashControlWnd m_ControlWnd;
}
LRESULT CFlashWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT ret=DefWindowProc();
HRESULT hr = CreateControlEx(L"{D27CDB6E-AE6D-11CF-96B8-444553540000}",0,0,0,__uuidof(_IShockwaveFlashEvents),
(IUnknown*)static_cast<IDispEventImpl<1,CFlashWnd,&__uuidof(_IShockwaveFlashEvents),&__uuidof(ShockwaveFlash)>*>(this)
);
if (FAILED(hr))
{
MessageBox("Flash插件未安装");
return -1;
}
hr = QueryControl(__uuidof(IShockwaveFlash),(void**)&m_pFlash);
if (FAILED(hr))
{
MessageBox("Flash插件未安装");
return -1;
}
CComPtr<IOleWindow> pWindow;
QueryControl(&pWindow);
if (pWindow)
{
HWND hWnd;
if (SUCCEEDED(pWindow->GetWindow(&hWnd)))
{
m_ControlWnd.SubclassWindow(hWnd);
QueryControl(&m_ControlWnd.pObj);
}
}
return 0;
}
[/code]
class CFlashControlWnd:public CWindowImpl<CFlashControlWnd>
{
BEGIN_MSG_MAP(CFlashWnd)
if (uMsg==WM_RBUTTONDOWN)
{
return 1;
}
else if (uMsg==WM_KEYDOWN || uMsg==WM_SYSKEYDOWN || uMsg==WM_KEYUP || uMsg==WM_SYSKEYUP)
{
HRESULT hr = pObj->TranslateAccelerator((LPMSG)m_pCurrentMsg);
if (hr==S_OK)
{
return 1;
}
}
else if (uMsg == WM_CHAR)
{
return GetAsyncKeyState(VK_CONTROL)||GetAsyncKeyState(VK_LCONTROL) || GetAsyncKeyState(VK_RCONTROL);
}
END_MSG_MAP()
public:
CComPtr<IOleInPlaceActiveObject> pObj;
};
class CFlashWnd :
public CWindowImpl<CFlashWnd,CAxWindow>,
public IDispEventImpl<1,CFlashWnd,&__uuidof(_IShockwaveFlashEvents),&__uuidof(ShockwaveFlash)>
{
CFlashControlWnd m_ControlWnd;
}
LRESULT CFlashWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT ret=DefWindowProc();
HRESULT hr = CreateControlEx(L"{D27CDB6E-AE6D-11CF-96B8-444553540000}",0,0,0,__uuidof(_IShockwaveFlashEvents),
(IUnknown*)static_cast<IDispEventImpl<1,CFlashWnd,&__uuidof(_IShockwaveFlashEvents),&__uuidof(ShockwaveFlash)>*>(this)
);
if (FAILED(hr))
{
MessageBox("Flash插件未安装");
return -1;
}
hr = QueryControl(__uuidof(IShockwaveFlash),(void**)&m_pFlash);
if (FAILED(hr))
{
MessageBox("Flash插件未安装");
return -1;
}
CComPtr<IOleWindow> pWindow;
QueryControl(&pWindow);
if (pWindow)
{
HWND hWnd;
if (SUCCEEDED(pWindow->GetWindow(&hWnd)))
{
m_ControlWnd.SubclassWindow(hWnd);
QueryControl(&m_ControlWnd.pObj);
}
}
return 0;
}