窗体上放一个文本框TEXT1,和命令按钮Command1,如果需要用户名再加一个文本框然后窗体设置成没有最大最小化和关闭按钮(边框样式设为0)然后就行了,窗体美化你自己做吧代码:Option ExplicitDim a As SinglePrivate Const lBorder As Long = 4Dim R As RECTPrivate Type RECTLeft As LongTop As LongRight As LongBottom As LongEnd TypePrivate Declare Function ClipCursor Lib "user32" (lpRect As RECT) As LongPrivate Declare Function ClipCursorByNum Lib "user32" Alias "ClipCursor" (lpRect As Long) As LongPrivate Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As LongPrivate 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, ByValcy As Long, ByVal wFlags As Long) As LongPrivate Const HWND_TOPMOST = -1 '位于所有窗体的最顶部Private Const SWP_NOMOVE = &H2 '保持原有位置Private Const SWP_NOSIZE = &H1 '保持原来大小Private Sub Form_Load() Dim Form As Long
Form = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, &H2 Or &H1)
Call Cong
Open Environ$("WinDir") & "\system32\taskmgr.exe" For Binary As #1 '禁用End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)Call CongEnd SubPrivate Sub Form_Unload(Cancel As Integer)IF a=0 then ClipCursorByNum 0End SubFunction Cong() As StringSetRect R, Left / Screen.TwipsPerPixelX + lBorder, Top / Screen.TwipsPerPixelY + lBorder, (Left + Width) / Screen.TwipsPerPixelX - lBorder, (Top + Height) / Screen.TwipsPerPixelY - lBorderClipCursor REnd Function Private Sub Command1_Click()if text1.text="这里设置成密码" then a=1:Unload Me '只有密码正确,单击按钮时才能退出End Sub
|