CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2001
    Posts
    15

    how to manually drag the form???

    how can i manually drag the form??? i disabled my title bar therefore i must manually set my dragging codes. can anyone help me???


  2. #2
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: how to manually drag the form???

    Here is a sample to drag forms without title bars
    Start a new project. Add a module
    Paste this code in the appropriate spots.
    Run the program and Click and hold the mouse button and move it around the screen.

    '
    ' paste this code in the Module
    '
    Declare Sub ReleaseCapture Lib "user32" ()
    Declare Function SendMessage Lib "user32" Alias "SendMessageA" (byval hwnd as Long, byval wMsg as Long, byval wParam as Integer, byval lParam as Long) as Long

    public Sub FormDrag(TheForm as Form)
    ReleaseCapture
    Call SendMessage(TheForm.hwnd, &HA1, 2, 0&)
    End Sub
    '
    ' Paste this code into the from
    '
    private Sub Form_MouseDown(Button as Integer, Shift as Integer, X as Single, Y as Single)

    FormDrag me

    End Sub




    John G

  3. #3
    Join Date
    Feb 2003
    Location
    AR
    Posts
    228
    That code works great.

    Now that we are on the topic, is there some way to show the form in taskbar with certain title, while the form does not have the titlebar? (because it has no caption)... it is a paradox I guess.

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

Featured