Hallo alle wer-weiss-was Wisser,
das Program mit dem untenstehen Code funktioniert so halb, denn der OpenProcess Befehl erzeugt den Fehler, dass es kein gültiges window-handle sei.
kann mir jemand helfen???
MfG und ty im voraus
haithun
Imports System.Runtime.InteropServices
Public Class Form1
Private Shared Function GetWindowThreadProcessId(ByVal handle As IntPtr, ByRef processId As IntPtr) As Int32
End Function
Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
End Function
Private Shared Function OpenProcess(ByVal access As Integer, ByVal inherit As Boolean, ByVal processId As IntPtr) As IntPtr
End Function
Private Shared Function CloseHandle(ByVal hObject As IntPtr) As Integer
End Function
Private Shared Function GetLastError() As Integer
End Function
Const PROCESS\_ALL\_ACCESS = &H1F0FFF
Private Sub Form1\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim hwnd
Dim procid As IntPtr
Dim procidhandle As IntPtr
hwnd = FindWindow(vbNullString, "Element Client")
GetWindowThreadProcessId(hwnd, procid)
MsgBox(procid)
procidhandle = OpenProcess(PROCESS\_ALL\_ACCESS, False, procid)
MsgBox(GetLastError())
CloseHandle(procidhandle)
End Sub
End Class