webbrowser Click


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: webbrowser Click

  1. #1
    Join Date
    Aug 2009
    Posts
    2

    webbrowser Click

    hi im useing this Code to Simulate Mouseclicks on the Screen
    Code:
    Module WinFromPoint
    
        Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" ( _
        ByVal hwnd As IntPtr, _
        ByVal wMsg As Int32, _
        ByVal wParam As Int32, _
        ByVal lParam As Int32) As Int32
    
        Public Declare Function WindowFromPoint Lib "user32" ( _
        ByVal stPoint As Point) As IntPtr
    
        Public Const WM_LBUTTONDOWN = &H201
        Public Const WM_LBUTTONUP = &H202
    
        Public Sub DoClick()
    
            Dim MyPoint As Point
            MyPoint.X = 50
            MyPoint.Y = 50
    
            Dim ptHwnd As IntPtr = WindowFromPoint(MyPoint)
    
            Dim retVal As Int32 = PostMessage(ptHwnd, WM_LBUTTONDOWN, 0, 0&)
    
            retVal = PostMessage(ptHwnd, WM_LBUTTONUP, 0, 0&)
    
        End Sub
    
    End Module
    but when i try to have it click a button in my form1.webbrowser it doesn't click it ? anyone know why ? it can click anything on my form1 but if i try to have it click a button inside my webbrowser at the x,y it is at it doesn't click it if anyone could Help me out the would be Great
    & i know how to Click buttons in a webbrowser but i just want to do it list way

  2. #2
    Join Date
    Jun 2009
    Posts
    135
    Make sure that your forms scalemode property is set to pixels and that you add your forms left and top to where you want to return the windows hWnd from as the WindowFromPoint starts at the screens left and top, not your forms left and top.


    Good Luck

  3. #3
    Join Date
    Aug 2009
    Posts
    2
    Quote Originally Posted by vb5prgrmr View Post
    Make sure that your forms scalemode property is set to pixels and that you add your forms left and top to where you want to return the windows hWnd from as the WindowFromPoint starts at the screens left and top, not your forms left and top.


    Good Luck
    how do i do that ? sorry im a Noobie

  4. #4
    Join Date
    Jun 2009
    Posts
    135
    look in properties window next to scalemode and using the api is not typical noob behavior

Similar Threads

  1. Replies: 1
    Last Post: 04-25-2007, 12:39 PM
  2. Replies: 0
    Last Post: 03-08-2007, 05:24 PM
  3. Putting text into a WebBrowser
    By Keithuk in forum VB Classic
    Replies: 2
    Last Post: 10-29-2005, 09:57 AM
  4. Dual boot of Linux with Windows 2000.
    By Jacob Peter K in forum Open Source
    Replies: 8
    Last Post: 06-02-2004, 03:20 AM
  5. Remove exchange from a site
    By andriano in forum Enterprise
    Replies: 1
    Last Post: 10-02-2000, 04:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center