Kontakt
DSVGO
'----- Deklarationsteil ----- Option Explicit Private Const GWL_WNDPROC = -4 'Messagetypen: Private Const WM_ACTIVATEAPP = &H1C Private Const WM_ENTERSIZEMOVE = &H231 Private Const WM_EXITSIZEMOVE = &H232 Private Const WM_MOVING = &H216 Private Const WM_SIZING = &H214 Private Declare Function CallWindowProcA Lib "user32" ( _ ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, _ ByVal Msg As Long, ByVal wParam As Long, _ ByVal lParam As Long) As Long Private Declare Function SetWindowLongA Lib "user32" ( _ ByVal hWnd As Long, ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private VorigeAddr As Long 'Ursprünglicher Empfänger Private WinHandle As Long 'Windows-Objekt-Handle '----- Prozeduren ----- Public Sub DoSubClass(ByVal hWnd As Long) WinHandle = hWnd VorigeAddr = SetWindowLongA(hWnd, GWL_WNDPROC, _ AddressOf TestWndProc) End Sub Public Sub UndoSubClass() SetWindowLongA WinHandle, GWL_WNDPROC, VorigeAddr End Sub Public Function TestWndProc( _ ByVal hWnd As Long, ByVal uMsg As Long, _ ByVal wParam As Long, ByVal lParam As Long) As Long 'Nachricht "analysieren": If uMsg = WM_MOVING Then Beep 'Nachricht weiterleiten: TestWndProc = CallWindowProcA(VorigeAddr, hWnd, _ uMsg, wParam, lParam) End FunctionGeben Sie im Code-Bereich des Formulars folgendes ein:
Private Sub Form_Load() DoSubClass Me.hWnd End Sub Private Sub Form_Unload(Cancel As Integer) UndoSubClass End SubSpeichern Sie das ganze Projekt ab und starten Sie erst dann das Programm. Wenn das Formular nun auf dem Bildschirm verschoben wird, ertönt eine Folge von Beep-Lauten... Jeder Beep entspricht einer WM_MOVING-Nachricht!
If uMsg = WM_MOVING Then Beepeinfach nur
Beep
schreiben, so daß es bei jeder Windows-Nachricht an das Formular piept... Viel Vergnügen! © Jost Schwider, 29.04.2000-30.04.2000 - http://vb-tec.de/subclas3.htm