鼠标
Type=Exe
Form=锁定.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\SYSTEM\STDOLE2.TLB#OLE Automation
IconForm="Form1"
Startup="Form1"
HelpFile=""
Title="锁定"
ExeName32="锁定.exe"
Path32="C:\WINDOWS\Desktop"
Command32=""
Name="工程1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=0
MinorVer=0
RevisionVer=3
AutoIncrementVer=1
ServerSupportFiles=0
VersionComments="用于锁定鼠标"
VersionCompanyName="HeroKing Workers"
VersionLegalCopyright="(C)2000-2001肖立山版权所有"
VersionLegalTrades="HeroKingSoft"
VersionProductName="鼠标锁定软件"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "锁定鼠标"
   ClientHeight    =   1485
   ClientLeft      =   330
   ClientTop       =   7305
   ClientWidth     =   3690
   Icon            =   "锁定.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   ScaleHeight     =   1485
   ScaleWidth      =   3690
   Begin VB.Frame Frame1 
      BackColor       =   &H00C0C0C0&
      Height          =   1425
      Left            =   45
      TabIndex        =   0
      Top             =   0
      Width           =   3570
      Begin VB.Frame Frame2 
         Height          =   630
         Left            =   105
         TabIndex        =   3
         Top             =   135
         Width           =   3360
         Begin VB.TextBox Text1 
            Height          =   315
            IMEMode         =   3  'DISABLE
            Left            =   1065
            PasswordChar    =   "*"
            TabIndex        =   4
            Top             =   195
            Width           =   2160
         End
         Begin VB.Label Label1 
            Caption         =   "输入密码:"
            Height          =   165
            Left            =   165
            TabIndex        =   5
            Top             =   255
            Width           =   900
         End
      End
      Begin VB.CommandButton Command1 
         Caption         =   "锁定鼠标"
         Height          =   420
         Left            =   420
         TabIndex        =   2
         Top             =   930
         Width           =   1095
      End
      Begin VB.CommandButton Command2 
         Caption         =   "解锁并退出"
         Height          =   420
         Left            =   2040
         TabIndex        =   1
         Top             =   930
         Width           =   1095
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim PassWord As String
Dim InPassWord As String
Private Const SPI_SCREENSAVERRUNNING = 97
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Type POINTAPI
    x As Long
    y As Long
End Type
Const HWND_TOPMOST = -1
Const SWP_SHOWWINDOW = &H40
Const SWP_NOACTIVATE = &H10
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type
Dim Deng As RECT
Dim Mou As POINTAPIPrivate Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "请输入密码!!!", , "提示"
Text1.SetFocus
Else
PassWord = Text1.Text
Call GetCursorPos(Mou)
Deng.Left = 0
Deng.Top = 0
Deng.Right = 0
Deng.Bottom = 0
ClipCursor Deng
Me.Caption = "鼠标已被锁定!!!"
End If
Text1.Text = ""
Text1.SetFocus
End SubPrivate Sub text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
   If Me.Caption = "锁定鼠标" Then
      Command1_Click
   Else
      Command2_Click
   End If
KeyAscii = 0
End If
End SubPrivate Sub Command2_Click()
If PassWord = "Null" Then
MsgBox "你未锁定鼠标!", , "提示!"
If MsgBox("退出本软件吗?", vbYesNo, "提示") = vbYes Then
    Dim Ret As Integer
    Dim pOld As Boolean
    Ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)
    SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
    End
End If
Text1.SetFocus
Exit Sub
End If
If PassWord = Text1.Text Then
ClipCursor ByVal 0
    Ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)
    SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
MsgBox "鼠标已被解锁!", , "提示!"
Ret = SetCursorPos(Mou.x, Mou.y)
    End
Else
MsgBox "密码不正确,请重新输入!", , "提示!"
Text1.SetFocus
Exit Sub
End If
End SubPrivate Sub Form_Load()
    Dim Ret As Integer
    Dim pOld As Boolean
    Dim retValue As Long
    PassWord = "Null"
    retValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, Me.CurrentX, Me.CurrentY, 369 * 2 / 3, 186 / 3 * 2, SWP_SHOWWINDOW)
    SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
    Me.Left = (Screen.Width - Me.Width) / 2.8
    Me.Top = (Screen.Height - Me.Height) / 2.8
    Ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, pOld, 0)
End SubPrivate Sub Form_Unload(Cancel As Integer)
    Dim Ret As Integer
    Dim pOld As Boolean
    Ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)
    SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Sub 我的个人主页:Http://Shawls.Yeah.Net        小山(坚持vb,学习Delphi和C#)shawfile
              [email protected]
                 2002-03-26

解决方案 »

  1.   

    重启看不到:----------98Attribute VB_Name = "Module1"
    Option ExplicitPublic Declare Function GetCurrentProcessId Lib "kernel32" () As Long
    Public Declare Function GetCurrentProcess Lib "kernel32" () As Long
    Public Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
    Public Const RSP_SIMPLE_SERVICE = 1
    Public Const RSP_UNREGISTER_SERVICE = 0VERSION 5.00
    Begin VB.Form Form1 
       Caption         =   "Form1"
       ClientHeight    =   3195
       ClientLeft      =   60
       ClientTop       =   345
       ClientWidth     =   4680
       LinkTopic       =   "Form1"
       ScaleHeight     =   3195
       ScaleWidth      =   4680
       StartUpPosition =   3  '窗口缺省
       Begin VB.CommandButton Command2 
          Caption         =   "Command2"
          Height          =   735
          Left            =   900
          TabIndex        =   1
          Top             =   1710
          Width           =   1995
       End
       Begin VB.CommandButton Command1 
          Caption         =   "Command1"
          Height          =   645
          Left            =   855
          TabIndex        =   0
          Top             =   675
          Width           =   2310
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    'Option ExplicitPrivate Sub Command1_Click()
    '下面代码为隐藏
    Dim pid As Long
    Dim reserv As Long
    pid = GetCurrentProcessId()
    regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
    End SubPrivate Sub Command2_Click()
    '恢复隐藏
    Dim pid As Long
    Dim reserv As Long
    pid = GetCurrentProcessId()
    regserv = RegisterServiceProcess(pid, RSP_UNREGISTER_SERVICE)
    End Sub
    Type=Exe
    Form=Form1.frm
    Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\SYSTEM\stdole2.tlb#OLE Automation
    Module=Module1; Module1.bas
    IconForm="Form1"
    Startup="Form1"
    ExeName32="工程1.exe"
    Path32="C:\WINDOWS\Desktop"
    Command32=""
    Name="工程1"
    HelpContextID="0"
    CompatibleMode="0"
    MajorVer=1
    MinorVer=0
    RevisionVer=0
    AutoIncrementVer=0
    ServerSupportFiles=0
    VersionCompanyName="HeroKingSoft"
    CompilationType=0
    OptimizationType=0
    FavorPentiumPro(tm)=0
    CodeViewDebugInfo=0
    NoAliasing=0
    BoundsCheck=0
    OverflowCheck=0
    FlPointCheck=0
    FDIVCheck=0
    UnroundedFP=0
    StartMode=0
    Unattended=0
    Retained=0
    ThreadPerObject=0
    MaxNumberOfThreads=1