Sub Initialize
'Dim alle benodigde variabelen
'Otherxxx is voor database waar we naar toe kopieren
'Andere zijn de DBRS-database
Dim session As New NotesSession
Dim db As NotesDatabase
Dim otherdb As NotesDatabase
Dim view As NotesView
Dim otherview As NotesView
Dim doc As NotesDocument
Dim copydoc As NotesDocument
Dim otherdoc As NotesDocument
Dim servernaam As String
Dim pad As String
'DBRS-database
Set db = session.currentdatabase
Set view = db.GetView("Databases")
Set copydoc = view.GetFirstDocument
'Terwijl er nog documenten zijn om informatie uit te halen...
While Not ( copydoc Is Nothing )
'Haal uit document de contactinformatie van de database waar wij naar toe gaan kopieren
servernaam = copydoc.ServerNaam(0)
pad = copydoc.pad(0)
'Externe database waar naar toe wordt gekopieerd
Set doc = view.GetFirstDocument
Set otherdb = session.GetDatabase(servernaam, pad)
Set otherview = otherdb.GetView("Databases")
Set otherdoc = otherview.GetFirstDocument
'Verwijder de documenten in de view van de externe database
While Not ( otherdoc Is Nothing)
Call otherdoc.Remove( True )
Set otherdoc = otherview.GetFirstDocument
Wend
'De documenten kopieren van de DBRS-database naar de externe
While Not ( doc Is Nothing )
Call doc.CopyToDatabase(otherdb)
Set doc = view.GetNextDocument(doc)
Wend
'Pak het volgende document
Set copydoc = view.GetNextDocument(copydoc)
Wend
End Sub
every one of us has heard the call
brothers of true autism
proud and standing tall
we know the autism within us
has brought us to this hall
there's magic in the autism
there's magic in us all
atypical autism
or no autism at all
asperger's sufferers leave the hall
atypical autism
or no autism at all
asperger's sufferers leave the hall
all the world must listen
to our decree
we don't turn down for anyone
we do just what we please
got to make it more autistic
true men play on ten
if you are not autistic
you are not my friend
atypical autism
or no autism at all
asperger's sufferers leave the hall
atypical autism
or no autism at all
asperger's sufferers leave the hall
Option Explicit
Private WithEvents m_frmSysTray As frmSysTray
Attribute m_frmSysTray.VB_VarHelpID = -1
Private blnServerEnabled As Boolean
Dim connection As Integer
Dim Log As New clsLog
Dim port As Integer
Dim cmdline() As String
Const asciiBackspace As Integer = 8
Const asciiLineFeed As Integer = 10
Const cmdPrompt As String = "]"
Private Sub cmdToggleServer_Click()
If blnServerEnabled Then
'disable server
StopServer
Else
'enable server
StartServer
End If
blnServerEnabled = Not blnServerEnabled
End Sub
Private Sub StopServer()
'make sure server isn't already stopped
If Not blnServerEnabled Then
Exit Sub
End If
cmdToggleServer.Caption = "&Start Server"
Me.Icon = imgServerOff.Picture
m_frmSysTray.IconHandle = Me.Icon.Handle
m_frmSysTray.ToolTip = "Remote Control (server disabled)"
'reenable connection options
lblPort.Enabled = True
txtPort.Enabled = True
fraConnection.Enabled = True
'disable server
Log.Log "Disabling server..."
socket.Close
End Sub
Private Sub StartServer()
'make sure server isn't already enabled
If blnServerEnabled Then
Exit Sub
End If
cmdToggleServer.Caption = "&Stop Server"
Me.Icon = imgServerOn.Picture
m_frmSysTray.IconHandle = Me.Icon.Handle
m_frmSysTray.ToolTip = "Remote Control (server enabled: port " & txtPort.Text & ")"
'disable connection options
lblPort.Enabled = False
txtPort.Enabled = False
fraConnection.Enabled = False
'enable server
Log.Log "Enabling server..."
port = Val(txtPort.Text)
socket.LocalPort = port
socket.Listen
Log.Log "Server enabled on port " & txtPort.Text & "."
End Sub
Private Sub Form_Load()
blnServerEnabled = False
Log.OpenLog App.Path & "\RemoteControl.log", 1
Set m_frmSysTray = New frmSysTray
With m_frmSysTray
.AddMenuItem "&Open Configuration", "open", True
.AddMenuItem "&Close Configuration", "close"
.AddMenuItem "-"
.AddMenuItem "&Start Server", "start"
.AddMenuItem "S&top Server", "stop"
.AddMenuItem "-"
.AddMenuItem "E&xit Remote Control", "exit"
.ToolTip = "Remote Control (server disabled)"
.IconHandle = Me.Icon.Handle
End With
Log.Log "Remote Control v" & App.Major & "." & App.Minor & "." & App.Revision
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim mbox As VbMsgBoxStyle
'CHANGE THIS BACK
'CHANGE THIS BACK
'CHANGE THIS BACK
'CHANGE THIS BACK
'CHANGE THIS BACK
'CHANGE THIS BACK
'CHANGE THIS BACK
'CHANGE THIS BACK
mbox = vbYes 'MsgBox("Are you sure you want to quit?", vbQuestion + vbYesNo)
If mbox = vbNo Then
Cancel = 1
Exit Sub
End If
'if server is running, close it
If blnServerEnabled Then StopServer
Unload m_frmSysTray
Set m_frmSysTray = Nothing
Log.CloseLog
End Sub
Private Sub Form_Resize()
If Me.WindowState = vbMinimized Then
Me.Hide
Me.WindowState = vbNormal
End If
End Sub
Private Sub m_frmSysTray_MenuClick(ByVal lIndex As Long, ByVal sKey As String)
Select Case sKey
Case "open"
Me.Show
Me.WindowState = vbNormal
Me.ZOrder
Case "close"
Me.Hide
Case "start"
StartServer
Case "stop"
StopServer
Case "exit"
Unload Me
End Select
End Sub
Private Sub m_frmSysTray_SysTrayDoubleClick(ByVal eButton As MouseButtonConstants)
Me.Show
Me.WindowState = vbNormal
Me.ZOrder
End Sub
Private Sub m_frmSysTray_SysTrayMouseDown(ByVal eButton As MouseButtonConstants)
If (eButton = vbRightButton) Then
m_frmSysTray.ShowMenu
End If
End Sub
Private Sub remote_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim inData As String
Dim tmpChar As String * 1
Dim cmd As String
Dim i As Integer
Dim running As Boolean
remote(Index).GetData inData, vbString
'go through each character and handle it
For i = 1 To bytesTotal
tmpChar = Mid$(inData, i, 1)
If Asc(tmpChar) = asciiLineFeed Then 'end command on line feed
If cmdline(Index) = "" Then
remote(Index).SendData cmdPrompt
End If
cmd = cmdline(Index)
cmdline(Index) = ""
ElseIf Asc(tmpChar) = asciiBackspace Then 'handle backspace properly
If Len(cmdline(Index)) > 0 Then
cmdline(Index) = Left$(cmdline(Index), Len(cmdline(Index)) - 1)
End If
ElseIf Asc(tmpChar) < 32 Then 'drop control characters
'just do nothing
Else
cmdline(Index) = cmdline(Index) + tmpChar
End If
Next i
If cmd <> "" Then
ConnLog Index, "User input: " & cmd
running = ParseCommand(cmd, remote(Index))
If Not running Then
ConnLog Index, "Connection dropped."
remote(Index).Close
Unload remote(Index)
Exit Sub
End If
remote(Index).SendData cmdPrompt
End If
End Sub
Private Sub socket_ConnectionRequest(ByVal requestID As Long)
Dim ip As String
Dim i As Integer
ip = socket.RemoteHostIP
Log.Log "Received connection from " & ip & " (requestID " & requestID & ")."
'find unused connection
For i = 0 To 32766
If Not IsObject(remote(i)) Then
connection = i
Exit For
End If
Next i
Load remote(connection)
remote(connection).Accept requestID
ConnLog connection, "Connection accepted (requestID " & requestID & ")."
ReDim Preserve cmdline(connection) As String
'send welcome message
remote(connection).SendData vbCrLf
remote(connection).SendData "Welcome to Remote Control v" & App.Major & "." & App.Minor & "." & App.Revision & "!" & vbCrLf
remote(connection).SendData "Type 'help' for a list of commands." & vbCrLf & vbCrLf & cmdPrompt
'remote(Connection).SendData "Start typing stuff, and type 'exit' on a line by itself to disconnect." & vbCrLf & vbCrLf & cmdPrompt
connection = connection + 1
End Sub
Private Sub txtPort_Validate(Cancel As Boolean)
'k, this should take care of most foul-ups
txtPort = Abs(Int(Val(txtPort)))
'and this will take care of the rest
If Val(txtPort) < 1024 Then txtPort = 1024
If Val(txtPort) > 65535 Then txtPort = 65535
End Sub
Private Sub ConnLog(connection As Integer, Message As String)
Log.Log "(" & connection & ") " & Message
End Sub