| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2337 人关注过本帖
标题:如何完全禁止VB程序的右键.
只看楼主 加入收藏
杀风
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2004-12-14
收藏
 问题点数:0 回复次数:6 
如何完全禁止VB程序的右键.

因为嵌入FLASH

FLASH控件没有.HWND所有用钓子生成EXE之后就不好使了.

请问有谁有更好的方法

希望得到回得....

QQ52061601

搜索更多相关主题的帖子: 如何 
2004-12-14 16:38
杀风
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2004-12-14
收藏
得分:0 

亲爱的版主

如果你不长来这里你就不要做了吗

让能二十四小时在线的人来做

发贴没人吊是很惨的。

2004-12-14 22:58
杀风
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2004-12-14
收藏
得分:0 

谢谢了

我把他给解决了

原来如此简单

呵呵。我真是绝顶聪明哎

2004-12-15 00:59
chenwei5451656
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-4-15
收藏
得分:0 
[讨论]
你知道怎么在把文本框中的右键菜单屏蔽吗?

2005-04-16 00:03
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
收藏
得分:0 

1.将Flash控件放入一个容器,比如PictureBox(可以把PictureBox的边框去掉),然后把PictureBox的Enabled设为False就可以禁用Flash右键,不过,也禁用了Flash动画的所有鼠标事件了。 2.如何屏蔽文本框右键菜单 使用子类技术 '窗体中代码 Option Explicit

Private Const GWL_WNDPROC = (-4)

Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then Exit Sub ' 取得窗口函数的地址 OldWindowProc = GetWindowLong(Text1.hWnd, GWL_WNDPROC) ' 用SubClass1_WndMessage代替窗口函数处理消息 Call SetWindowLong(Text1.hWnd, GWL_WNDPROC, AddressOf SubClass1_WndMessage) End Sub

Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then Exit Sub ' 恢复窗口的默认函数 Call SetWindowLong(Text1.hWnd, GWL_WNDPROC, OldWindowProc) ' 弹出自定义菜单 'PopupMenu usermenu End Sub

'模块中代码 Option Explicit

Public OldWindowProc As Long ' 保存默认的窗口函数的地址 Public Const WM_CONTEXTMENU = &H7B ' 当右击文本框时,产生这条消息

Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Public Function SubClass1_WndMessage(ByVal hWnd As OLE_HANDLE, ByVal Msg As OLE_HANDLE, ByVal wp As OLE_HANDLE, ByVal lp As Long) As Long If Msg <> WM_CONTEXTMENU Then SubClass1_WndMessage = CallWindowProc(OldWindowProc, hWnd, Msg, wp, lp) ' 如果消息不是WM_CONTEXTMENU,就调用默认的窗口函数处理 Exit Function End If SubClass1_WndMessage = True End Function


天津网站建设 http://www./
2005-04-16 19:10
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
收藏
得分:0 

Flash控件没有Hwnd属性,但是可以通过别的途径取得 ' 窗体模块 Option Explicit Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long Dim Handle As Long ' 窗口句柄 Private Sub Form_Load() Dim ParentHandle As Long ' 父窗口句柄 ParentHandle = FindWindow("ThunderFormDC", "Form1") ' 获得父窗口句柄 Handle = FindWindowEx(ParentHandle, 0&, "MacromediaFlashPlayerActiveX", vbNullString) ' 获得窗口句柄 ret = SetWindowLong(Handle, GWL_WNDPROC, AddressOf WindowProc) End Sub

Private Sub Form_Unload(Cancel As Integer) SetWindowLong Handle, GWL_WNDPROC, ret End Sub ' 标准模块 Option Explicit Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function TrackPopupMenu Lib "user32" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hwnd As Long, ByVal lprc As Any) As Long Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long Public Const GWL_WNDPROC = (-4) Private Const TPM_LEFTALIGN = &H0& Private Const WM_RBUTTONDOWN = &H204 Private Type POINTAPI x As Long y As Long End Type Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Public ret As Long ' SetWindowLong 的回调函数, 利用 Msg 拦截消息 Function WindowProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long If Msg = WM_RBUTTONDOWN Then Dim pos As POINTAPI, hMenu As Long GetCursorPos pos hMenu = GetSubMenu(GetMenu(Form1.hwnd), 0) TrackPopupMenu hMenu, TPM_LEFTALIGN, pos.x, pos.y, ByVal 0&, hwnd, ByVal 0& Exit Function End If WindowProc = CallWindowProc(ret, hwnd, Msg, wParam, lParam) End Function

[此贴子已经被作者于2005-4-16 19:34:23编辑过]


天津网站建设 http://www./
2005-04-16 19:31
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
收藏
得分:0 
以下是引用杀风在2004-12-14 22:58:19的发言:

亲爱的版主

如果你不长来这里你就不要做了吗

让能二十四小时在线的人来做

发贴没人吊是很惨的。

版主也是人,也是有自己的工作,有自己的事情,要吃、喝、拉、撒的,版主都是义务工作,不拿一分钱报酬,让版主24小时在线,版主还活吗?24小时在线有必要吗? 你想想你对论坛做出什么贡献了吗?不要光想着自己。。。


天津网站建设 http://www./
2005-04-16 19:41
快速回复:如何完全禁止VB程序的右键.
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019189 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved