Results 1 to 11 of 11

Thread: Disable form moving

  1. #1
    MerryVIP
    Guest

    Disable form moving

    Simply: how can I do that?

    (and I want to have titlebar and an icon and close button in it)


    Thanks for any help,

  2. #2
    Matthew Gates
    Guest
    Set the Form's Moveable property to False.

  3. #3
    MerryVIP
    Guest
    There is no moveable in VB4

  4. #4
    Matthew Gates
    Guest
    Damn, you can't subclass either .
    So just have a timer, set it's interval at 1, and make the Top and Left property whatever you want them to stay at.

  5. #5
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Matthew, you can do it by the RemoveMenu API:

    Code:
    Option Explicit
    '//WIN32API Declare
    Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
    Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
    
    '//WIN32API Constant
    Private Const MF_BYPOSITION = &H400&
    
    
    Private Sub Form_Load()
        Dim hMenu As Long
        
        '//Get the Menu handle
        hMenu = GetSystemMenu(Me.hwnd, 0)
        
        '//Reference
        '// Position 0 is Restore Button
        '// Position 1 is Move Button
        '// Position 2 is Size Button
        '// Position 3 is Max Button
        '// Position 4 is Min Button
        '// Position 5 is Seperator
        '// Position 6 is Close Button
        
        '//Remove the X button
        RemoveMenu hMenu, 1, MF_BYPOSITION
    End Sub
    NOTE: But this Position will change upon 1 element is being remove from the menu

  6. #6
    MerryVIP
    Guest
    Ok, thanks, I check it out

  7. #7
    MerryVIP
    Guest
    The API thingy didn't work. I also tried removing other things, but it just didn't work. Does it only work with sizable form? Because I tried it only for fixed form.

  8. #8
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    It work fine for me (when I change it to Fixed Single/Fixed Dialog).
    Perhaps you try to copy the GetSystemMenu and RemoveMenu API declare from your VB4.0 API Viewer.

  9. #9
    Megatron
    Guest
    Are you using a 16-bit version of windows?

  10. #10
    MerryVIP
    Guest
    Nop, Win98.

    I try Chris' tip

  11. #11
    MerryVIP
    Guest
    Okay, it's working, thanks

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