Hi there,
I'm writing this application that gets the current tune from Winamp, iTunes and YouTube (video in YouTube's case!), and I had this working before, and I'm getting it working up to a point now, but what I have keeps on returning integers instead of the text.
So far I've got:
This isn't the whole application, but just the bits for this problem. I've been trying different things and searching google for ages now, so I'll have to give in and ask. I've got up to the point where it returned 0 if it didn't find YouTube and 46 if it did.
Would appreciate any help.
Thanks
Dug
I'm writing this application that gets the current tune from Winamp, iTunes and YouTube (video in YouTube's case!), and I had this working before, and I'm getting it working up to a point now, but what I have keeps on returning integers instead of the text.
So far I've got:
Code:
Public Function GetWindowHandle(ByVal partialTitle As String) As IntPtr
For Each p As Process In Process.GetProcesses()
If p.MainWindowTitle.IndexOf(partialTitle, 0, _
StringComparison.CurrentCultureIgnoreCase) > -1 Then
Return p.MainWindowHandle 'Found Window
End If
Next
Return IntPtr.Zero 'No Match Found
End Function
Private Function GetYouTubeVideo() As String
Dim hWnd As Integer
Dim Length As Integer
Dim hWndApp As Integer ' Window handle from GetWinHandle
Dim title As String
'The below statement is where you would put your partial title
'If you want to change it to play around you can see how it works.
hWnd = FindWindow("YouTube", Nothing)
' Begin search for handle
hWndApp = GetWindowHandle(hWnd)
Length = GetWindowTextLength(hWnd) + 1
Return title
This isn't the whole application, but just the bits for this problem. I've been trying different things and searching google for ages now, so I'll have to give in and ask. I've got up to the point where it returned 0 if it didn't find YouTube and 46 if it did.
Would appreciate any help.
Thanks
Dug