Results 1 to 7 of 7

Thread: No mouseover

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Location
    Ca
    Posts
    93
    What would be the code for any size of button to keep the cursor off of it?
    Timbudtwo
    I have no life, only one with computers.

    VB 6.0 Enterprise Edition
    [hr]

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    you mean having cursor avoiding that area? Use Setcursorpos api to move cursor
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Location
    Ca
    Posts
    93

    Question what is that?

    well I sorta wanted the code, the button in the size of 6 of those little dots on the form.
    Timbudtwo
    I have no life, only one with computers.

    VB 6.0 Enterprise Edition
    [hr]

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Try something like this:
    Code:
    Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
    Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
    Private Type POINTAPI
            x As Long
            y As Long
    End Type
    
    Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
        Dim pt As POINTAPI
        pt.x = x / Screen.TwipsPerPixelX
        pt.y = y / Screen.TwipsPerPixelY
        Caption = pt.x
        ClientToScreen Command1.hwnd, pt
        SetCursorPos pt.x - y / Screen.TwipsPerPixelX, pt.y - y / Screen.TwipsPerPixelY
    End Sub
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Location
    Ca
    Posts
    93

    nope

    Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
    Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
    Private Type POINTAPI
    x As Long
    y As Long
    End Type

    Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim pt As POINTAPI
    pt.x = x / Screen.TwipsPerPixelX
    pt.y = y / Screen.TwipsPerPixelY
    Caption = pt.x
    ClientToScreen Command1.hwnd, pt
    SetCursorPos pt.x - y / Screen.TwipsPerPixelX, pt.y - y / Screen.TwipsPerPixelY
    End Sub
    doen't work
    what would?
    Timbudtwo
    I have no life, only one with computers.

    VB 6.0 Enterprise Edition
    [hr]

  6. #6
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Works for me

    Just change it a little. Add a module and declare the API's and the Type Public there:

    In a basic module:
    Code:
    Public Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
    Public Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
    
    Public Type POINTAPI
            x As Long
            y As Long
    End Type
    And in the form's code window:
    Code:
    Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
        Dim pt As POINTAPI
        pt.x = x / Screen.TwipsPerPixelX
        pt.y = y / Screen.TwipsPerPixelY
        Caption = pt.x
        ClientToScreen Command1.hwnd, pt
        SetCursorPos pt.x - y / Screen.TwipsPerPixelX, pt.y - y / Screen.TwipsPerPixelY
    End Sub
    ~seaweed

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    What did you change? It worked on mine. also remove that caption line, it's not nessesary
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width