Урок 5
Заблокировать кнопку ПУСК.
Код:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function EnableWindow Lib "user32" _
(ByVal hwnd As Long, ByVal fEnable As Long) As Long
Public Sub EnableStartButton(Optional Enabled As Boolean = True)
'this will enable/disable any window with a little modifaction
Dim lHwnd As Long
'найти hWnd
lHwnd& = FindWindowEx(FindWindow("Shell_TrayWnd", ""), 0&, "Button", vbNullString)
'call the enablewindow api and do the what needs to be done
Call EnableWindow(lHwnd&, CLng(Enabled))
End Sub
Private Sub Form_Load()
EnableStartButton True 'Кнопка ПУСК не заблокирована
'EnableStartButton False 'Кнопка ПУСК заблокирована
В разделе Примеры, Вы можете скачать пример этого урока.
Назад