The VB code below tries to get the Window title character for the First Active Window. I have error Poping up on my screen when I run this. Error "No Creatable Public Component detected" " MSDN Collection Doesn't Exits" What i need to do to get ride of this error? Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, _ ByVal wCmd As Long) As Long Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _ (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Public Declare Function GetWindowThreadProcessId Lib "user32" _ (ByVal hwnd As Long, lpdwprocessid As Long) As Long Private Sub Command1_Click() Dim tempHWin As Long Dim StringDisplay As String Dim CountOfBytes As Integer Dim Buffer As String Dim Instnace As Long tempHWin = FindWindow(vbNullString, vbNullString) Buffer = Space$(128) CountOfBytes = GetWindowText(tempHWin, Buffer, Len(Buffer)) Instance = ProcIDFromWnd(tempHWin) StringDisplay = StringDisplay & Left$(Buffer, CountOfBytes) & tempHWin & Instance Text1 = StringDisplay End Sub Function ProcIDFromWnd(ByVal hwnd As Long) As Long Dim idProc As Long ' Get PID for this HWnd GetWindowThreadProcessId hwnd, idProc ' Return PID ProcIDFromWnd = idProc End Function
Praveen