Dragging a web address into a text box.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sparky

    #1

    Dragging a web address into a text box.

    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
    TYIA
    Graham




  • J French

    #2
    Re: Dragging a web address into a text box.

    On Fri, 27 Jun 2003 09:47:46 +0000 (UTC), "Sparky"
    <graham_it@yaho o.com> wrote:
    [color=blue]
    >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[/color]

    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


    Comment

    • Bob Butler

      #3
      Re: Dragging a web address into a text box.

      "Sparky" <graham_it@yaho o.com> wrote in message news:<bdh3s2$bt 8$1@hercules.bt internet.com>.. .[color=blue]
      > 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?[/color]

      Private Sub Form_Load()
      Text1.OLEDropMo de = vbOLEDragAutoma tic
      End Sub

      Private Sub Text1_OLEDragDr op(Data As DataObject, Effect As Long, _
      Button As Integer, Shift As Integer, X As Single, Y As Single)
      Text1.Text = Data.GetData(vb CFText)
      End Sub
      [color=blue]
      > 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?[/color]

      copy & paste ?
      [color=blue]
      > I would appreciate any help on this problem
      > TYIA
      > Graham[/color]

      Comment

      • Steve Gdula

        #4
        Re: Dragging a web address into a text box.

        Quick and Dirty method: Right Click and copy into the clipboard.
        Right click on your text box and paste.

        You may also use vb code with the built-in clipboard object.

        Comment

        Working...