home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / webmon_1 / frmmain.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-07-30  |  17.7 KB  |  565 lines

  1. VERSION 5.00
  2. Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
  3. Object = "{C40817A0-3291-11D2-9233-0008C744D2C9}#1.0#0"; "FASTLOGIN.OCX"
  4. Object = "{BB859389-001D-11D1-8E83-00805F3AEC32}#1.0#0"; "SYSTRAY.OCX"
  5. Begin VB.Form FrmMain 
  6.    Caption         =   "Form1"
  7.    ClientHeight    =   4005
  8.    ClientLeft      =   165
  9.    ClientTop       =   735
  10.    ClientWidth     =   8865
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4005
  13.    ScaleWidth      =   8865
  14.    StartUpPosition =   3  'Windows Default
  15.    Visible         =   0   'False
  16.    Begin VB.TextBox DDELink 
  17.       Height          =   285
  18.       Left            =   1080
  19.       TabIndex        =   6
  20.       Text            =   "Text1"
  21.       Top             =   3180
  22.       Width           =   3435
  23.    End
  24.    Begin VB.Timer Timer2 
  25.       Interval        =   10000
  26.       Left            =   3360
  27.       Top             =   2760
  28.    End
  29.    Begin VB.Timer Timer1 
  30.       Enabled         =   0   'False
  31.       Interval        =   500
  32.       Left            =   3480
  33.       Top             =   2040
  34.    End
  35.    Begin SysTrayCtl.cSysTray cSysTray1 
  36.       Left            =   240
  37.       Top             =   2940
  38.       _ExtentX        =   900
  39.       _ExtentY        =   900
  40.       InTray          =   0   'False
  41.       TrayIcon        =   "FrmMain.frx":0000
  42.       TrayTip         =   "FastBoss Click to open Toolbar"
  43.    End
  44.    Begin FastLogin.FastLogn FastLogn1 
  45.       Left            =   1080
  46.       Top             =   2400
  47.       _ExtentX        =   3096
  48.       _ExtentY        =   767
  49.    End
  50.    Begin VB.CommandButton Command3 
  51.       Caption         =   "Log On"
  52.       Height          =   435
  53.       Left            =   2280
  54.       TabIndex        =   5
  55.       Top             =   960
  56.       Width           =   1815
  57.    End
  58.    Begin VB.CommandButton Command6 
  59.       Caption         =   "Command6"
  60.       Height          =   435
  61.       Left            =   2280
  62.       TabIndex        =   4
  63.       Top             =   300
  64.       Width           =   1575
  65.    End
  66.    Begin VB.CommandButton Command5 
  67.       Caption         =   "show hover"
  68.       Height          =   375
  69.       Left            =   60
  70.       TabIndex        =   3
  71.       Top             =   540
  72.       Width           =   2000
  73.    End
  74.    Begin VB.CommandButton Command4 
  75.       Caption         =   "update"
  76.       Height          =   255
  77.       Left            =   60
  78.       TabIndex        =   2
  79.       Top             =   1020
  80.       Width           =   2000
  81.    End
  82.    Begin VB.CommandButton Command2 
  83.       Caption         =   "request team"
  84.       Height          =   375
  85.       Left            =   60
  86.       TabIndex        =   1
  87.       Top             =   1860
  88.       Width           =   2000
  89.    End
  90.    Begin MSWinsockLib.Winsock Winsock1 
  91.       Left            =   360
  92.       Top             =   2400
  93.       _ExtentX        =   741
  94.       _ExtentY        =   741
  95.       _Version        =   327681
  96.       Protocol        =   1
  97.    End
  98.    Begin VB.CommandButton Command1 
  99.       Caption         =   "show team"
  100.       Height          =   375
  101.       Left            =   60
  102.       TabIndex        =   0
  103.       Top             =   60
  104.       Width           =   2000
  105.    End
  106.    Begin VB.Image Image1 
  107.       Height          =   480
  108.       Index           =   1
  109.       Left            =   4080
  110.       Picture         =   "FrmMain.frx":08DA
  111.       Top             =   2520
  112.       Width           =   480
  113.    End
  114.    Begin VB.Image Image1 
  115.       Height          =   480
  116.       Index           =   0
  117.       Left            =   4080
  118.       Picture         =   "FrmMain.frx":11A4
  119.       Top             =   1800
  120.       Width           =   480
  121.    End
  122.    Begin VB.Menu personclickdrop 
  123.       Caption         =   "Personclickdrop"
  124.       Begin VB.Menu sendmessage 
  125.          Caption         =   "Send Message"
  126.       End
  127.       Begin VB.Menu OpenPortal 
  128.          Caption         =   "Open Portal"
  129.       End
  130.       Begin VB.Menu AvatarCreate 
  131.          Caption         =   "Test New Portal"
  132.       End
  133.       Begin VB.Menu bar001 
  134.          Caption         =   "-"
  135.       End
  136.       Begin VB.Menu NameSlot 
  137.          Caption         =   "<Name>"
  138.       End
  139.       Begin VB.Menu TeleSlot 
  140.          Caption         =   "<Tele>"
  141.       End
  142.       Begin VB.Menu FaxSlot 
  143.          Caption         =   "<Fax>"
  144.       End
  145.    End
  146.    Begin VB.Menu statusdrop 
  147.       Caption         =   "Statusdrop"
  148.       Begin VB.Menu statuschange 
  149.          Caption         =   "Available"
  150.          Index           =   0
  151.       End
  152.       Begin VB.Menu statuschange 
  153.          Caption         =   "-"
  154.          Index           =   1
  155.       End
  156.       Begin VB.Menu statuschange 
  157.          Caption         =   "Busy"
  158.          Index           =   2
  159.       End
  160.       Begin VB.Menu statuschange 
  161.          Caption         =   "Do Not Disturb"
  162.          Index           =   3
  163.       End
  164.       Begin VB.Menu statuschange 
  165.          Caption         =   "Not at Desk"
  166.          Index           =   4
  167.       End
  168.       Begin VB.Menu statuschange 
  169.          Caption         =   "On Phone"
  170.          Index           =   5
  171.       End
  172.       Begin VB.Menu statuschange 
  173.          Caption         =   "Break"
  174.          Index           =   6
  175.       End
  176.       Begin VB.Menu statuschange 
  177.          Caption         =   "Stepped Out"
  178.          Index           =   7
  179.       End
  180.       Begin VB.Menu statuschange 
  181.          Caption         =   "-"
  182.          Index           =   8
  183.       End
  184.       Begin VB.Menu statuschange 
  185.          Caption         =   "Other"
  186.          Index           =   9
  187.       End
  188.    End
  189.    Begin VB.Menu intraydrop 
  190.       Caption         =   "intraydrop"
  191.       Begin VB.Menu viewmessage 
  192.          Caption         =   "View Full Message"
  193.       End
  194.       Begin VB.Menu replytomessage 
  195.          Caption         =   "Reply"
  196.       End
  197.       Begin VB.Menu deletemessage 
  198.          Caption         =   "Delete"
  199.       End
  200.    End
  201.    Begin VB.Menu sentmsgdrop 
  202.       Caption         =   "sentmsgdrop"
  203.       Begin VB.Menu DeleteSentMsg 
  204.          Caption         =   "Delete"
  205.       End
  206.    End
  207.    Begin VB.Menu persondrop 
  208.       Caption         =   "PersonDrop"
  209.       Begin VB.Menu sendclip 
  210.          Caption         =   "Send ClipBoard"
  211.       End
  212.       Begin VB.Menu SendUrl 
  213.          Caption         =   "Send Url"
  214.       End
  215.       Begin VB.Menu fhfhg 
  216.          Caption         =   "-"
  217.       End
  218.       Begin VB.Menu removeportal 
  219.          Caption         =   "Remove Portal"
  220.       End
  221.    End
  222.    Begin VB.Menu PortalData 
  223.       Caption         =   "PortalData"
  224.       Begin VB.Menu PortalStore 
  225.          Caption         =   "No Data"
  226.          Index           =   0
  227.       End
  228.       Begin VB.Menu PortalStore 
  229.          Caption         =   "2."
  230.          Index           =   1
  231.          Visible         =   0   'False
  232.       End
  233.       Begin VB.Menu PortalStore 
  234.          Caption         =   "3."
  235.          Index           =   2
  236.          Visible         =   0   'False
  237.       End
  238.       Begin VB.Menu PortalStore 
  239.          Caption         =   "4."
  240.          Index           =   3
  241.          Visible         =   0   'False
  242.       End
  243.       Begin VB.Menu PortalStore 
  244.          Caption         =   "5."
  245.          Index           =   4
  246.          Visible         =   0   'False
  247.       End
  248.       Begin VB.Menu PortalStore 
  249.          Caption         =   "6."
  250.          Index           =   5
  251.          Visible         =   0   'False
  252.       End
  253.       Begin VB.Menu PortalStore 
  254.          Caption         =   "7."
  255.          Index           =   6
  256.          Visible         =   0   'False
  257.       End
  258.       Begin VB.Menu PortalStore 
  259.          Caption         =   "8."
  260.          Index           =   7
  261.          Visible         =   0   'False
  262.       End
  263.       Begin VB.Menu PortalStore 
  264.          Caption         =   "9."
  265.          Index           =   8
  266.          Visible         =   0   'False
  267.       End
  268.       Begin VB.Menu PortalStore 
  269.          Caption         =   "10."
  270.          Index           =   9
  271.          Visible         =   0   'False
  272.       End
  273.    End
  274. Attribute VB_Name = "FrmMain"
  275. Attribute VB_GlobalNameSpace = False
  276. Attribute VB_Creatable = False
  277. Attribute VB_PredeclaredId = True
  278. Attribute VB_Exposed = False
  279. Private Sub AvatarCreate_Click()
  280.   Dim fred As New FrmPerson
  281.   'fred.Label1.Caption = CurrentPerson.Name
  282.   'fred.Label1.Tag = CurrentPerson.Address
  283.   'fred.Show
  284.   CreateAvatar CurrentPerson.Userid, CurrentPerson.Address, CurrentPerson.Name, ""
  285. End Sub
  286. Private Sub Command1_Click()
  287.   FrmTeam.Show
  288. End Sub
  289. Private Sub Command10_Click()
  290.   GetRealEstate xtop, xleft, xright, xbottom
  291. End Sub
  292. Private Sub Command2_Click()
  293.   Dim Opstr As String
  294.   msql = "SELECT FASTBOSS.USER_DETAILS.* FROM FASTBOSS.TEAM_MEMBER , FASTBOSS.USER_DETAILS  WHERE FASTBOSS.TEAM_MEMBER.USER_ID = FASTBOSS.USER_DETAILS.USER_ID and FASTBOSS.TEAM_MEMBER.TEAM_ID =3"
  295.   Opstr = "0101" & msql & "|"
  296.   senc = Encrypt(Opstr, 8479, 4597)
  297.   Winsock1.RemoteHost = ServerAddr
  298.   Winsock1.RemotePort = 19000
  299.   Winsock1.SendData senc
  300. End Sub
  301. Private Sub Command3_Click()
  302.   Dim Opstr As String
  303.   msql = "UPDATE fastboss.user_details "
  304.   msql = msql & "SET fastboss.user_details.status = 'Logged On',"
  305.   msql = msql & "fastboss.user_details.status_changed = " & ToDateNow() & ","
  306.   msql = msql & "fastboss.user_details.ip_address='" & LazyBastard(FrmMain.Winsock1.LocalIP) & "',"
  307.   msql = msql & "fastboss.user_details.current_location='" & "From Laptop" & "',"
  308.   msql = msql & "fastboss.user_details.roving_tel_no='" & "01202897274" & "',"
  309.   msql = msql & "fastboss.user_details.logged_on = " & ToDateNow() & ""
  310.   msql = msql & " where fastboss.user_details.user_id='" & CurrentUserId & "'"
  311.   Debug.Print msql
  312.   Opstr = "0201" & msql & "|"
  313.   senc = Encrypt(Opstr, 8479, 4597)
  314.   Winsock1.RemoteHost = ServerAddr
  315.   Winsock1.RemotePort = 19000
  316.   Winsock1.SendData senc
  317. End Sub
  318. Private Sub Command4_Click()
  319.   Dim Opstr As String
  320.   'msql = "SELECT FASTBOSS.USER_DETAILS.* FROM FASTBOSS.TEAM_MEMBER , FASTBOSS.USER_DETAILS  WHERE FASTBOSS.TEAM_MEMBER.USER_ID = FASTBOSS.USER_DETAILS.USER_ID and FASTBOSS.TEAM_MEMBER.TEAM_ID =3"
  321.   msql = "UPDATE fastboss.user_details SET fastboss.user_details.status = 'turkey' where fastboss.user_details.user_id='eapkw02'"
  322.   Opstr = "0201" & msql & "|"
  323.   senc = Encrypt(Opstr, 8479, 4597)
  324.   Winsock1.RemoteHost = ServerAddr
  325.   Winsock1.RemotePort = 19000
  326.   Winsock1.SendData senc
  327. End Sub
  328. Private Sub Command5_Click()
  329.   FrmFloat.FormShaper1.ShapeIt "sme"
  330.   FrmFloat.Show
  331. End Sub
  332. Private Sub Command6_Click()
  333.   Dim Opstr As String
  334.   msql = "SELECT FASTBOSS.TEAM.* FROM FASTBOSS.TEAM"
  335.   Opstr = "0102" & msql & "|"
  336.   senc = Encrypt(Opstr, 8479, 4597)
  337.   Winsock1.RemoteHost = ServerAddr
  338.   Winsock1.RemotePort = 19000
  339.   Winsock1.SendData senc
  340. End Sub
  341. Private Sub Command8_Click()
  342.   Dim ipfull As String, ipsmall As String
  343.   ipfull = Winsock1.LocalIP
  344.   ipsmall = LazyBastard(ipfull)
  345.   For tmp1 = 1 To 4
  346.     Debug.Print Asc(Mid(ipsmall, tmp1, 1))
  347.   Next
  348. End Sub
  349. Private Sub Command9_Click()
  350.   FrmMsgView.Show
  351. End Sub
  352. Private Sub cSysTray1_MouseDown(Button As Integer, Id As Long)
  353.   If Timer1.Enabled Then
  354.     'Must be a new mail message ... ensure toolbar is up and show messages
  355.     Timer1.Enabled = False
  356.     Set cSysTray1.TrayIcon = Image1(1).Picture
  357.     cSysTray1.TrayTip = "FastBoss Click to open Toolbar"
  358.     If Not FrmCtlBar.Visible Then
  359.       DrawCtlBar
  360.       ShowPopUpWin FrmCtlBar
  361.     End If
  362.     If Not FrmMsgView.Visible Then
  363.         FrmMsgView.ZOrder 1
  364.         FrmMsgView.Top = FrmCtlBar.Top
  365.         FrmMsgView.Left = 2500
  366.         onestep = FrmMsgView.Height / 5
  367.         FrmCtlBar.ZOrder
  368.         FrmMsgView.Show
  369.         For tmp1 = 1 To 5
  370.           FrmMsgView.Top = FrmMsgView.Top - onestep
  371.           For tmp2 = 1 To 50: DoEvents: Next
  372.         Next
  373.         FrmMsgView.Top = FrmCtlBar.Top - FrmMsgView.Height
  374.         FrmMsgView.Show
  375.     Else
  376.       FrmMsgView.Show
  377.     End If
  378.   Else
  379.     If FrmCtlBar.Visible Then
  380.       HideCtlBar
  381.     Else
  382.       DrawCtlBar
  383.       ShowPopUpWin FrmCtlBar
  384.     End If
  385.   End If
  386. End Sub
  387. Private Sub cSysTray2_MouseDown(Button As Integer, Id As Long)
  388.   Timer1.Enabled = False
  389.   cSysTray2.InTray = False
  390. End Sub
  391. Private Sub deletemessage_Click()
  392.   If FrmMsgView.MSFlexGrid1.Rows = 1 Then
  393.     FrmMsgView.MSFlexGrid1.Rows = 0
  394.   Else
  395.     FrmMsgView.MSFlexGrid1.RemoveItem InTrayRow
  396.   End If
  397. End Sub
  398. Private Sub DeleteSentMsg_Click()
  399.   If FrmMsgView.MSFlexGrid2.Rows = 1 Or FrmMsgView.MSFlexGrid2.Rows = 0 Then
  400.     FrmMsgView.MSFlexGrid2.Rows = 0
  401.   Else
  402.     FrmMsgView.MSFlexGrid2.RemoveItem SentMessagesRow
  403.   End If
  404. End Sub
  405. Private Sub dragaccept_Click()
  406.   DragAcceptFiles Me.hwnd, True
  407. End Sub
  408. Private Sub dragdecline_Click()
  409.   DragAcceptFiles Me.hwnd, False
  410. End Sub
  411. Private Sub FastLogn1_LoginCancel()
  412.   End
  413. End Sub
  414. Private Sub FastLogn1_LoginResponse(Userid As String, AccessLevel As String, UserName As String, UserTele As String)
  415.   WriteLog "Setup sys tray"
  416.   cSysTray1.InTray = True
  417.   'now log on ...
  418.   LoggedOn = 1
  419.   CurrentUserId = Userid
  420.   Dim Opstr As String
  421.   WriteLog "Draw control bar"
  422.   DrawCtlBar
  423.   WriteLog "Show control bar as on top"
  424.   ShowPopUpWin FrmCtlBar
  425.   WriteLog "Get reg settings"
  426.   location = GetSetting("FastBoss", "Settings", "Location", "")
  427.   TeleNo = GetSetting("FastBoss", "Settings", "TeleNo", "")
  428.   FaxNo = GetSetting("FastBoss", "Settings", "FaxNo", "")
  429.   ServerAddr = GetSetting("FastBoss", "Settings", "ServerAddr", "132.146.197.83")
  430.   WriteLog "Build sql"
  431.   msql = "UPDATE fastboss.user_details "
  432.   msql = msql & "SET fastboss.user_details.status = 'Logged On',"
  433.   msql = msql & "fastboss.user_details.status_changed = " & ToDateNow() & ","
  434.   msql = msql & "fastboss.user_details.ip_address='" & LazyBastard(FrmMain.Winsock1.LocalIP) & "',"
  435.   msql = msql & "fastboss.user_details.current_location='" & location & "',"
  436.   msql = msql & "fastboss.user_details.roving_tel_no='" & TeleNo & "',"
  437.   msql = msql & "fastboss.user_details.roving_fax_no='" & FaxNo & "',"
  438.   msql = msql & "fastboss.user_details.logged_on = " & ToDateNow() & ""
  439.   msql = msql & " where fastboss.user_details.user_id='" & CurrentUserId & "'"
  440.   Debug.Print msql
  441.   Opstr = "0201" & msql & "|"
  442.   senc = Encrypt(Opstr, 8479, 4597)
  443.   Winsock1.RemoteHost = ServerAddr
  444.   Winsock1.RemotePort = 19000
  445.   WriteLog "Send Data " & senc
  446.   Winsock1.SendData senc
  447.   WriteLog "Data sent"
  448.   DoEvents
  449.   'Now get current users details
  450.   msql = "SELECT FASTBOSS.USER_DETAILS.* FROM FASTBOSS.user_details  where fastboss.user_details.user_id='" & CurrentUserId & "'"
  451.   Opstr = "0106" & msql & "|"
  452.   senc = Encrypt(Opstr, 8479, 4597)
  453.   FrmMain.Winsock1.RemoteHost = ServerAddr
  454.   FrmMain.Winsock1.RemotePort = 19000
  455.   FrmMain.Winsock1.SendData senc
  456.   DoEvents
  457. End Sub
  458. Private Sub Form_Load()
  459.   'FrmSplash.Show 1
  460.   FrmCtlBar.Label2.ToolTipText = "FastBoss Version " & App.Major & "." & App.Minor & " Rev " & App.Revision
  461.   If LoggedOn = 0 Then
  462.     Winsock1.Bind 19100
  463.     CRLF = Chr(13) & Chr(10)
  464.     FastLogn1.Login "FastBoss", "fastboss"
  465.     'FastLogn1_LoginResponse "stand01", 0, "Andy Derrick", "01202 206903"
  466.     'CurrentUserId = "stand01"
  467.     ShortBeepInterval = 4
  468.     CurrentTeam = "NCC11"
  469.     CurrentTeamIndex = 3
  470.   End If
  471. End Sub
  472. Private Sub OpenPortal_Click()
  473.   Dim fred As New FrmPerson
  474.   fred.Label1.Caption = CurrentPerson.Name
  475.   fred.Label1.Tag = CurrentPerson.Address
  476.   fred.Show
  477. End Sub
  478. Private Sub PortalStore_Click(Index As Integer)
  479.   On Error GoTo e_trap
  480.   iRet = ShellExecute(Me.hwnd, vbNullString, PortalStore(Index).Tag, vbNullString, "c:\", SW_SHOWNORMAL)
  481.   Exit Sub
  482. e_trap:
  483.   Debug.Print Err.Description
  484.   Resume Next
  485. End Sub
  486. Private Sub removeportal_Click()
  487.   DeleteAvatar CurrentPerson.Userid
  488.   Unload Me
  489. End Sub
  490. Private Sub replytomessage_Click()
  491.   ShowAtCursor FrmSendMessage, 0, 0, 0
  492. End Sub
  493. Private Sub sendclip_Click()
  494.   Dim clipdata As String
  495.   Debug.Print "Start clipboard stuff"
  496.   Debug.Print Clipboard.GetFormat(1)
  497.   clipdata = Clipboard.GetData
  498.   Debug.Print clipdata
  499. End Sub
  500. Private Sub sendmessage_Click()
  501.   ShowAtCursor FrmSendMessage, 1, 0, 0
  502. End Sub
  503. Private Sub SendUrl_Click()
  504.   With FrmMain.Winsock1
  505.   msgstring = "C100" & CurrentURL.Title & "|" & CurrentURL.Link & "|" & User.Name & "|"
  506.   'msgstring = "C100" & "Test|Test|"
  507.   .RemoteHost = CurrentPerson.Address
  508.   .RemotePort = 19100
  509.   Debug.Print msgstring
  510.   .SendData msgstring
  511.   Debug.Print msgstring
  512.   End With
  513. End Sub
  514. Private Sub statuschange_Click(Index As Integer)
  515.   If statuschange(Index).Caption <> "Other" Then
  516.     UpdateStatus statuschange(Index).Caption
  517.   Else
  518.     ShowAtCursor FrmCustStatus, 1, 0, 0
  519.   End If
  520. End Sub
  521. Private Sub Timer1_Timer()
  522.     If BeepCounter > 0 Then
  523.       BeepCounter = BeepCounter - 1
  524.       Beep
  525.     End If
  526.   If cSysTray1.Tag = "Y" Then
  527.     Set cSysTray1.TrayIcon = Image1(0).Picture
  528.     cSysTray1.Tag = "N"
  529.   Else
  530.     Set cSysTray1.TrayIcon = Image1(1).Picture
  531.     cSysTray1.Tag = "Y"
  532.   End If
  533. End Sub
  534. Private Sub Timer2_Timer()
  535.   On Error GoTo e_trap
  536.   Winsock1.RemoteHost = ServerAddr
  537.   Winsock1.RemotePort = 2
  538.   Winsock1.SendData "Ping!"
  539.   Exit Sub
  540. e_trap:
  541.   Resume Next
  542. End Sub
  543. Private Sub viewmessage_Click()
  544.   FrmView.Label1.Caption = CurrentMessage.msg
  545.   FrmView.Label3.Caption = CurrentMessage.Name
  546.   FrmView.Show
  547. End Sub
  548. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
  549.   Dim tdata As String, InAddress As String
  550.   Winsock1.GetData tdata
  551.   InAddress = Winsock1.RemoteHostIP
  552.   Inport = Winsock1.RemotePort
  553.   Debug.Print tdata
  554.   HandleMessages tdata, InAddress, Inport
  555. End Sub
  556. Function MinsToTime(InMins)
  557.   xhours = Int(InMins / 60)
  558.   xmins = InMins - (xhours * 60)
  559.   If xhours > 999 Then
  560.     MinsToTime = "999>>"
  561.   Else
  562.     MinsToTime = Format(xhours, "00") & ":" & Format(xmins, "00")
  563.   End If
  564. End Function
  565.