vb 防止右键关闭 5

怎么样防止在任务栏右键关闭程序,只能单击关闭按钮关闭或者有什么事件是用在这的?有个queryclose不知道怎么用……... 怎么样防止在任务栏右键关闭程序,只能单击关闭按钮关闭
或者有什么事件是用在这的?有个queryclose 不知道怎么用……
展开
 我来答
百度网友4684e1e
推荐于2016-09-17 · TA获得超过2309个赞
知道小有建树答主
回答量:1266
采纳率:0%
帮助的人:555万
展开全部
1.你的意思是不是不想程序不再任务栏上显示啊?
from的ShowInTaskbar 设置为False就可以了
2.你的意思是在任务管理器中无程序图标吗?
在From中加入app.taskvisvble=fllase
3.如果只想用户点击程序结束程序的话,这个就麻烦了,既要调用API了。
Private Sub Form_Load()

App.TaskVisible = False

HideCurrentProcess
End Sub '模组中代码
Option Explicit
Private Const STATUS_INFO_LENGTH_MISMATCH = &HC0000004
Private Const STATUS_ACCESS_DENIED = &HC0000022
Private Const STATUS_INVALID_HANDLE = &HC0000008
Private Const ERROR_SUCCESS = 0&
Private Const SECTION_MAP_WRITE = &H2
Private Const SECTION_MAP_READ = &H4
Private Const READ_CONTROL = &H20000
Private Const WRITE_DAC = &H40000
Private Const NO_INHERITANCE = 0
Private Const DACL_SECURITY_INFORMATION = &H4Private Type IO_STATUS_BLOCK

Status

As Long

Information As Long
End TypePrivate Type UNICODE_STRING

Length

As Integer

MaximumLength As Integer

Buffer

As Long
End TypePrivate Const OBJ_INHERIT = &H2
Private Const OBJ_PERMANENT = &H10
Private Const OBJ_EXCLUSIVE = &H20
Private Const OBJ_CASE_INSENSITIVE = &H40
Private Const OBJ_OPENIF = &H80
Private Const OBJ_OPENLINK = &H100
Private Const OBJ_KERNEL_HANDLE = &H200
Private Const OBJ_VALID_ATTRIBUTES = &H3F2Private Type OBJECT_ATTRIBUTES

Length

As Long

RootDirectory As Long

ObjectName

As Long

Attributes

As Long

SecurityDeor
As Long

SecurityQualityOfService As Long
End TypePrivate Type ACL

AclRevision As Byte

Sbz1

As Byte

AclSize

As Integer

AceCount

As Integer

Sbz2

As Integer
End TypePrivate Enum ACCESS_MODE

NOT_USED_ACCESS

GRANT_ACCESS

SET_ACCESS

DENY_ACCESS

REVOKE_ACCESS

SET_AUDIT_SUCCESS

SET_AUDIT_FAILURE
End EnumPrivate Enum MULTIPLE_TRUSTEE_OPERATION

NO_MULTIPLE_TRUSTEE

TRUSTEE_IS_IMPERSONATE
End EnumPrivate Enum TRUSTEE_FORM

TRUSTEE_IS_SID

TRUSTEE_IS_NAME
End EnumPrivate Enum TRUSTEE_TYPE

TRUSTEE_IS_UNKNOWN

TRUSTEE_IS_USER

TRUSTEE_IS_GROUP
End EnumPrivate Type TRUSTEE

pMultipleTrustee

As Long

MultipleTrusteeOperation

As MULTIPLE_TRUSTEE_OPERATION

TrusteeForm

As TRUSTEE_FORM

TrusteeType

As TRUSTEE_TYPE

ptstrName

As String
End TypePrivate Type EXPLICIT_ACCESS

grfAccessPermissions

As Long

grfAccessMode

As ACCESS_MODE

grfInheritance

As Long

TRUSTEE

As TRUSTEE
End TypePrivate Type AceArray

List() As EXPLICIT_ACCESS
End TypePrivate Enum SE_OBJECT_TYPE

SE_UNKNOWN_OBJECT_TYPE = 0

SE_FILE_OBJECT

SE_SERVICE

SE_PRINTER

SE_REGISTRY_KEY

SE_LMSHARE

SE_KERNEL_OBJECT

SE_WINDOW_OBJECT

SE_DS_OBJECT

SE_DS_OBJECT_ALL

SE_PROVIDER_DEFINED_OBJECT

SE_WMIGUID_OBJECT
End EnumDeclare Function SetSecurityInfo Lib
"advapi32.dll " (ByVal Handle As Long, ByVal ObjectType As SE_OBJECT_TYPE, ByVal SecurityInfo As Long, ppsidOwner As Long, ppsidGroup As Long, ppDacl As Any, ppSacl As Any) As Long
Declare Function GetSecurityInfo Lib
"advapi32.dll " (ByVal Handle As Long, ByVal ObjectType As SE_OBJECT_TYPE, ByVal SecurityInfo As Long, ppsidOwner As Long, ppsidGroup As Long, ppDacl As Any, ppSacl As Any, ppSecurityDeor As Long) As Long

Declare Function SetEntriesInAcl Lib
"advapi32.dll " Alias
"SetEntriesInAclA " (ByVal cCountOfExplicitEntries As Long, pListOfExplicitEntries As EXPLICIT_ACCESS, ByVal OldAcl As Long, NewAcl As Long) As Long
Declare Sub BuildExplicitAccessWithName Lib
"advapi32.dll " Alias
"BuildExplicitAccessWithNameA " (pExplicitAccess As EXPLICIT_ACCESS, ByVal pTrusteeName As String, ByVal AccessPermissions As Long, ByVal AccessMode As ACCESS_MODE, ByVal Inheritance As Long)

Declare Sub RtlInitUnicodeString Lib
"NTDLL.DLL " (DestinationString As UNICODE_STRING, ByVal SourceString As Long)
Declare Function ZwOpenSection Lib
"NTDLL.DLL " (SectionHandle As Long, ByVal DesiredAccess As Long, ObjectAttributes As Any) As Long
Declare Function LocalFree Lib
"kernel32 " (ByVal hMem As Any) As Long
Private Declare Function CloseHandle Lib
"kernel32 " (ByVal hObject As Long) As Long
Declare Function MapViewOfFile Lib
"kernel32 " (ByVal hFileMappingObject As Long, ByVal dwDesiredAccess As Long, ByVal dwFileOffsetHigh As Long, ByVal dwFileOffsetLow As Long, ByVal dwNumberOfBytesToMap As Long) As Long
Declare Function UnmapViewOfFile Lib
"kernel32 " (lpBaseAddress As Any) As Long
Declare Sub CopyMemory Lib
"kernel32 " Alias
"RtlMoveMemory " (Destination As Any, Source As Any, ByVal Length As Long)
Declare Function GetVersionEx Lib
"kernel32 " Alias
"GetVersionExA " (LpVersionInformation As OSVERSIONINFO) As LongPrivate Type OSVERSIONINFO

dwOSVersionInfoSize As Long

dwMajorVersion

As Long

dwMinorVersion

As Long

dwBuildNumber

As Long

dwPlatformId

As Long

szCSDVersion

As String * 128
End Type

Private verinfo
As OSVERSIONINFO
Private g_hNtDLL As Long
Private g_hMPM

As Long
Private aByte(3) As Byte
Private g_pMapPhysicalMemory As Long

#13楼 回复于:2007-02-11 22:10:22
Public Sub HideCurrentProcess()

Dim thread

As Long

Dim process

As Long

Dim fw

As Long

Dim bw

As Long

Dim lOffsetFlink As Long

Dim lOffsetBlink As Long

Dim lOffsetPID

As Long

verinfo.dwOSVersionInfoSize = Len(verinfo)
If (GetVersionEx(verinfo))
<>
0
If verinfo.dwPlatformId = 2 The
If verinfo.dwMajorVersion = 5 Th
Select Case verinfo.dwMinorVersio
lOffsetFlink = &HA0
lOffsetBlink = &HA4
lOffsetPID = &H9C
况知慧9j
2011-05-15 · 超过67用户采纳过TA的回答
知道小有建树答主
回答量:275
采纳率:0%
帮助的人:0
展开全部
你可以用hook或子类拦截一下鼠标消息,当鼠标在任务栏并且鼠标按下右键,就把右键禁用,这只不过是个思路,不过可以完成。不知道还有没有更好的办法?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式