var<br> Form1: TForm1;<br> h: HWND;<br> proc: LongInt;<br><br>function WndProc2(hwnd: HWnd; Msg: UINT; wParam: wParam; lParam: LPARAM): Integer; stdcall;<br><br>implementation<br><br>{$R *.dfm}<br><br>function WndProc2(hwnd: HWnd; Msg: UINT; wParam: wParam;<br> lParam: LPARAM): Integer;<br>var<br> i: Integer;<br>begin<br> case Msg of<br> WM_LBUTTONUP: begin<br> MessageBeep(MB_ICONASTERISK);<br> end<br> end;<br> Result := CallWindowProc(TFNWndProc(proc), hwnd, Msg, wParam, lParam);<br>end;<br><br>procedure TForm1.InsertButton(const AParentHandle: THandle);<br>var<br> l: LongInt;<br>begin<br> h := CreateWindow('BUTTON', 'Hello',<br> WS_VISIBLE + WS_CHILD, 0, 0, 200, 20, AParentHandle, 0, 0, nil);<br> proc := GetWindowLong(h, GWL_WNDPROC);<br> l := LongInt(@WndProc2);<br> SetWindowLong(h, GWL_WNDPROC, l);<br>end;