On Fri, 27 Jun 2003 09:47:46 +0000 (UTC), "Sparky"
<gr*******@yaho o.com> wrote:
Does anyone know if dragging the URL from Internet Explorer and dropping it
into a text box in my own program is possible? erm ..and if so, how?
Failing that, is there some other method I can use to capture URL's to be
used in a VB6 program, without having to type the things in?
I would appreciate any help on this problem
This is not exactly 'dragging' - but it might solve your problem
Option Explicit
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function GetCursorPos _
Lib "user32" _
(lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint _
Lib "user32" _
(ByVal xPoint As Long, _
ByVal yPoint As Long) As Long
Private Declare Function GetClassName _
Lib "user32" _
Alias "GetClassNa meA" _
(ByVal hwnd As Long, _
ByVal lpClassName As String, _
ByVal nMaxCount As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessag eA"
( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Const WM_GETTEXT = &HD
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 500
End Sub
Private Function WindowInf() As String
Dim Hnd As Long, Buff$, Q&
Dim PT As POINTAPI
GetCursorPos PT
Hnd = WindowFromPoint (PT.X, PT.Y)
WindowInf = Str$(Hnd)
' ---
Buff$ = Space$(255)
Q& = GetClassName(Hn d, Buff$, Len(Buff$))
WindowInf = WindowInf + ":" + Left$(Buff$, Q)
' ---
Q& = SendMessage(Hnd , WM_GETTEXT, Len(Buff$), ByVal Buff$)
WindowInf = WindowInf + ":" + Left$(Buff$, Q)
End Function
Private Sub Timer1_Timer()
Me.Caption = WindowInf
End Sub