Attribute VB_Name = "Modul1"
Public Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Public Const SW_SHOWNormal = 1
Public Const SW_NORMAL = 1
Public Const SW_SHOWMaximized = 3
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOW = 5
Public Const SW_MINIMIZE = 6
Public Const SW_SHOWDEFAULT = 10
Public Const SW_MAX = 10
Public Const SW_RESTORE = 9

'** Message-Funktion für Screensaver-Aufruf
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Public Const WM_SYSCOMMAND = &H112
Public Const SC_SCREENSAVE = &HF140

Declare Function waveOutGetNumDevs Lib "winmm.dll" _
() As Long
Declare Function sndPlaySound Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Declare Function ExtractIcon Lib "shell32.dll" Alias _
"ExtractIconA" (ByVal hInst&, _
ByVal lpszExeFilename$, ByVal nIconIndex&) As Long
Declare Function DrawIcon Lib "user32" _
(ByVal hDC&, ByVal x&, _
ByVal y&, ByVal hIcon&) As Long

Type POINTAPI
        x As Long
        y As Long
End Type

Private Type rect
  left As Long
  top As Long
  right As Long
  bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32" _
(ByVal hwnd As Long, lpRect As rect) As Long
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Declare Function SetCursorPos Lib "user32" _
(ByVal x As Long, ByVal y As Long) As Long

Declare Function GetWindowsDirectory Lib "kernel32" _
Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Declare Function ExitWindowsEx Lib "user32" _
(ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Public Const EWX_LOGOFF = 0
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4
Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1

Public Flag1 As Boolean, Flag2 As Boolean, Flag3 As Boolean
Public flagSystem As Boolean
Public FlagUmbenennen As Boolean, FlagVerschieben As Boolean
Public Nr As Integer
Public Altertext As String
Public FlagDatei As Boolean
Public popFlag As Boolean
Public SchreibenFlag As Boolean

Sub ZentriereMauszeiger(hwnd As Long)
  Dim ButtonMitte As rect
  Dim x As Long, y As Long
  
  GetWindowRect hwnd, ButtonMitte
  x = ButtonMitte.left + ProgInf.Command1.Width / 2
  y = ButtonMitte.top + ProgInf.Command1.Height / 2
  
  'Alternativ gehts auch mit folgenden Zeilen
  'X = (ButtonMitte.left + ButtonMitte.right) / 2
  'Y = (ButtonMitte.bottom + ButtonMitte.top) / 2
   
  SetCursorPos x, y
End Sub










