СообЧа > База Знаний > Программирование > Visual Basic

Вопрос

Как скрыть программу, чтобы ее не видно было при нажатии Ctrl-Alt-Delete?

Ответ

Подготовьте проект, добавив в него форму.
- Кнопку с именем Command1
- Кнопку с именем Command2
Добавьте в форму:

Private Declare Function RegisterServiceProcess Lib "kernel32.dll" _
(ByVal dwProcessId As Long, ByVal dwType As Long) As Long
Private Declare Function GetCurrentProcessId Lib "kernel32.dll" () As Long

Private Sub Command1_Click()
Me.Caption = "Hide"
Call RegisterServiceProcess(GetCurrentProcessId, 1)
End Sub

Private Sub Command2_Click()
Me.Caption = "Show"
Call RegisterServiceProcess(GetCurrentProcessId, 0)
End Sub



\'Hide Application From Task Manager(Win95/98)
Declare Function RegisterServiceProcess lib "kernel32" (byval ProcessID
as long, byval ServiceFlags as Long) as long
Declare Function GetCurrentProcessId lib "kernel32" () as Long
\' ServiceFlags: 0 means unregister as a service, 1 means to register.
ret = RegisterServiceProcess (GetCurrentProcessId, 1)

\\\'Hide the app from the task manager(NT).
lRtn = GetWindow(frmHide.hwnd, GW_OWNER)
lRtn = ShowWindow(lRtn, SW_HIDE)


hackcode, @LEXis



Copyright © 2000-2004 Сообщество Чайников
Контактная информация