Results 1 to 5 of 5

Thread: Label Help [RESOLVED]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    300

    Label Help [RESOLVED]

    VB Code:
    1. Private Sub label13_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    2.     Dim Ret&
    3.        ReleaseCapture
    4.        Ret& = SendMessage(Me.hWnd, &HA1, 2, 0&)
    5.        
    6. End Sub

    one of my mates sent me this just before he signed of suppose to make it so i click the label and move the program around the screen because i removed the default ones.
    But it doesn't like ReleaseCapture.
    Do i have to turn something on within VB ?
    Last edited by Ricky1; Mar 9th, 2005 at 01:44 PM.
    Im Learning !!!!

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    300

    Re: Label Help

    VB Code:
    1. Declare Function ReleaseCapture Lib "user32.dll" () As Long
    2. Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

    forgot this bit but i still get a error.
    Im Learning !!!!

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Label Help

    ReleaseCapture is an API function that you need to declare.
    VB Code:
    1. Private Declare Function ReleaseCapture Lib "user32.dll" () As Long
    I would also suggest that, to make your code more descriptive, that you use constants for the message and the wParam argument you are using with SendMessage.
    VB Code:
    1. Private Const WM_NCLBUTTONDOWN As Long = &HA1
    2. Private Const HTCAPTION As Long = 2

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    300

    Re: Label Help [RESOLVED]

    i resolved it i just had to move that second bit of code i had into a module works great now.
    Im Learning !!!!

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Label Help

    Quote Originally Posted by Hack
    Labels don't have a handle, so if you wanted to use that to move a captionless form, you would need to either use the MouseMove event of the form, or a control that does have a handle, like a picture box.
    He's sending the message to the Form, so the code works.

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