Posted by : Unknown
Cara Membuat LockWindows Menggunakan Visual Basic 6.0 - Ikuti dengan teliti cara membuat program lockwindows.
1. Buka Visual Basic & pilih Standart.EXE
2. Atur properties BorderStyle menjadi 0-None
3. Tampilan Form1 akan menjadi seperti gambar di bawah ini
4. Masukkan 1 buah TextBox
5. Pada jendela properties dari Text1, isikan password char dengan tanda *
6. Masukkan 1 buah Label, dan ganti captionnya menjadi PASSWORD
7. Masukkan lagi 2 buah Timer dan atur nilai interval dari kedua timer ini adalah 1
8. Buka jendela kode dan masukkan kode di bawah ini :
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Private Declare Function PaintDesktop Lib _
"user32" (ByVal hdc As Long) As Long
Private Declare Sub 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)
Private Declare Function Putfocus Lib _
"user32" Alias "SetFocus" _
(ByVal hwnd As Long) As Long
Private Declare Function ShowCursor Lib _
"user32" (ByVal bShow As Long) As Long
Private Declare Function ShowWindow Lib _
"user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Declare Function FindWindow Lib _
"user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function BringWindowToTop _
Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Form_QueryUnload _
(Cancel As Integer, UnloadMode As Integer)
Dim H As Long
Timer1.Enabled = False
H = FindWindow("BaseBar", vbNullString)
If H Then ShowWindow H, 1
H = FindWindow("Shell_TrayWnd", vbNullString)
If H Then ShowWindow H, 1
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If UCase(Text1.Text) = "TESKUNCI" Then
Unload Me
Else
Text1 = ""
End If
KeyAscii = 0
End If
End Sub
Private Sub Timer1_Timer()
BringWindowToTop Me.hwnd
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, _
0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or _
SWP_NOMOVE Or SWP_NOSIZE
Dim H As Long
H = FindWindow("#32770", "Windows Task Manager")
If H Then ShowWindow H, 0
H = FindWindow("#32771", vbNullString)
If H Then ShowWindow H, 0
H = FindWindow("BaseBar", vbNullString)
If H Then ShowWindow H, 0
H = FindWindow("Shell_TrayWnd", vbNullString)
If H Then ShowWindow H, 0
Putfocus Text1.hwnd
End Sub
Private Sub Timer2_Timer()
PaintDesktop Me.hdc
End Sub
9. Catatan penting yang perlu diingat dari kode di atas yaitu pada tulisan “TESKUNCI” dapat diganti dengan password apa saja yang anda inginkan asalkan diketik dengan HURUF BESAR.
Semoga Bermanfaat.
Sumber
Subscribe to:
Post Comments (Atom)
0 Komentar
Jika ada yang kurang dimengerti silahkan kirimkan komentar Anda
Gunakanlah kata - kata yang sopan ツ