|
-
Sep 8th, 2002, 11:05 PM
#1
Thread Starter
New Member
Using FindWindow in VB.Net!??!
Problem is . . . I use this code in VB 6.0 and everything works peachy . . . when I enter it into VB .Net it compiles errorless but doesn't work . . . the FindWindow returns something like "325609862626246" instead of a smaller, more expected window handle . . . any help!? what's different with .Net . . . i bet it's something really easy!! thanks for any help . . . here's my code to find the title of Winamp:
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 GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Dim lngHWND As Long, lngLen As Long
Dim strCurrentSong As String
lngHWND = FindWindow("Winamp v1.x", vbNullString)
lngLen = GetWindowTextLength(lngHWND)
strCurrentSong = Space(lngLen)
Call GetWindowText(lngHWND, strCurrentSong, (lngLen + 1))
MsgBox(strCurrentSong)
D I G I F R E E
http://66.74.248.19/
-
Sep 9th, 2002, 01:23 AM
#2
Member
I am not sure wheter this going help or not... data type in vb.net is quite different from vb6. for example long in vb6 is become the integer type in vb.net. Therefore for any declaration long data type in the API in VB6 should change to integer type.
-
Sep 9th, 2002, 02:45 AM
#3
Thread Starter
New Member
why . . . why . . .
ok . . . problem solved i guess . . . i did what you said and replaced every "Long" with "Integer" in declarations and program and it works . . . I swear I read like 10 "What's different from VB6 to VB.Net" articles and not ONE mentioned this change once . . . thanks so much though
D I G I F R E E
http://66.74.248.19/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|