|
-
Dec 21st, 1999, 03:56 PM
#1
Thread Starter
New Member
Hello
I'd like to use the text behind '?' from my Internet Explorer address-bar in my ActiveX-control
For example in : http://www.vb-world.net/index.htm?msg=hello
i'd need the "msg=hello"
Please help me
Piet Hein
-
Dec 22nd, 1999, 12:49 PM
#2
Try this:
In a Module..
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Const WM_GETTEXT = &HD
Private lFound As Long
Public Function GetIEString(ByVal sFind As String) As String
Dim sText As String
Dim lHwnd As Long
lFound = 0
lHwnd = FindWindowEx(0&, 0&, "IEFrame", vbNullString)
If lHwnd Then Call EnumChildWindows(lHwnd, AddressOf EnumProc, 0&)
If lFound Then
sText = Space(255)
sText = Left$(sText, SendMessage(lFound, WM_GETTEXT, 255, ByVal sText))
If InStr(sText, sFind) Then
GetIEString = Mid$(sText, InStr(sText, sFind))
End If
End If
End Function
Private Function EnumProc(ByVal hWnd As Long, ByVal lParam As Long) As Long
Dim sClass As String * 255
Call GetClassName(hWnd, ByVal sClass, 255)
If LCase(Left(sClass, 4)) = "edit" Then
lFound = hWnd
Exit Function
End If
EnumProc = hWnd
End Function
In the Form..
Code:
Private Sub Command1_Click()
MsgBox GetIEString("?")
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Dec 27th, 1999, 07:21 PM
#3
Thread Starter
New Member
So here I am again, I'm sorry but this doesn't work (Will be my fault I think).
I tried it in a normal exe with IE at the background.
And I also tried it in an activeX-control loaded in IE, but the string stayed empty, although I added "?something" behind the "....htm".
I hope for some help again.
Thanks
Piet Hein
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
|