Ir para conteúdo
Fórum Script Brasil

platchuk

Membros
  • Total de itens

    2
  • Registro em

  • Última visita

Tudo que platchuk postou

  1. o vb não mostra nenhum erro aparente, mas quando eu clico no button ou uso um timer pra executar a funçao killwin ele da o erro Run-time error '424': Object required
  2. Galera, terminei um projeto aqui mas quando eu executo uso um timer/button pra executar uma açao da o erro Run-time error '424': Object required será q alguma coisa deve ta errada no code? vou postar ele pra vocês verem: Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long Declare Function sendmessagebystring Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long Declare Function getwindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long Public Const WM_CLOSE = &H10 Public Const GW_CHILD = 5 Public Const GW_HWNDFIRST = 0 Public Const GW_HWNDLAST = 1 Public Const GW_HWNDNEXT = 2 Public Const GW_HWNDPREV = 3 Public Const GW_MAX = 5 Public Const GW_OWNER = 4 Public Sub KillWin(Title As String) Dim a, hwnd hwnd = FindWindowByTitle(Title) a = sendmessagebystring(hwnd, WM_CLOSE, 0, 0) End Sub Function FindWindowByTitle(Title As String) Dim a, b, Caption a = getwindow(frmMain.hwnd, GW_OWNER) Caption = GetCaption(a) If InStr(1, LCase(Caption), LCase(Title)) <> 0 Then FindWindowByTitle = b Exit Function End If b = a Do While b <> 0: DoEvents b = getwindow(b, GW_HWNDNEXT) Caption = GetCaption(b) If InStr(1, LCase(Caption), LCase(Title)) <> 0 Then FindWindowByTitle = b Exit Do Exit Function End If Loop End Function Function GetCaption(hwnd) Dim hwndLength%, hwndTitle$, a% hwndLength% = GetWindowTextLength(hwnd) hwndTitle$ = String$(hwndLength%, 0) a% = GetWindowText(hwnd, hwndTitle$, (hwndLength% + 1)) GetCaption = hwndTitle$ End Function Private Sub Command1_Click() Call KillWin("WPE") End Sub
×
×
  • Criar Novo...