Verschieben eines Fensters verhindern
[Windows 95/98/NT/2000]

12.02.2001


Das Verschieben der eigenen Form oder aber eines fremden
    Fensters können Sie wie folgt verhindern:

ERFORDERLICHE OBJEKTE      
   keine
 FORM-CODE   
   Private Declare Function FindWindow Lib "user32" Alias _
      "FindWindowA" (ByVal lpClassName As String, _
      ByVal lpWindowName As String) As Long
   Private Declare Function GetSystemMenu Lib "user32" _
      (ByVal hWnd As Long, ByVal bRevert As Long) As Long
   Private Declare Function RemoveMenu Lib "user32" _
     (ByVal hMenu As Long, ByVal nPosition As Long, _
     ByVal wFlags As Long) As Long
   Private Sub FixWindow(hWnd As Long)
      Dim SysMenu As Long
      Dim Ret As Long
      SysMenu = GetSystemMenu(hWnd, False)
      Ret = RemoveMenu(SysMenu, &HF010&, &H0&)
   End Sub
   Private Sub Form_Load()
      'eigene Form
      FixWindow Me.hWnd
      'fremdes Fenster, hier calc.exe
      Dim wHandle As Long
      wHandle = FindWindow(vbNullString, "Rechner")
      If wHandle <> 0 Then FixWindow wHandle
   End Sub