home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / postit / postitse.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-10-26  |  36.2 KB  |  992 lines

  1. VERSION 4.00
  2. Begin VB.Form postit 
  3.    AutoRedraw      =   -1  'True
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "'Post-Note - 32 Bit' 
  6. 1995 Numatic International"
  7.    ClientHeight    =   6936
  8.    ClientLeft      =   2292
  9.    ClientTop       =   2832
  10.    ClientWidth     =   6264
  11.    BeginProperty Font 
  12.       name            =   "MS Sans Serif"
  13.       charset         =   0
  14.       weight          =   700
  15.       size            =   7.8
  16.       underline       =   0   'False
  17.       italic          =   0   'False
  18.       strikethrough   =   0   'False
  19.    EndProperty
  20.    ForeColor       =   &H80000008&
  21.    Height          =   7320
  22.    Icon            =   "POSTITSE.frx":0000
  23.    Left            =   2244
  24.    LinkTopic       =   "Form1"
  25.    MaxButton       =   0   'False
  26.    ScaleHeight     =   6936
  27.    ScaleWidth      =   6264
  28.    Top             =   2496
  29.    Width           =   6360
  30.    Begin VB.TextBox DDE 
  31.       Appearance      =   0  'Flat
  32.       Height          =   612
  33.       Left            =   576
  34.       TabIndex        =   18
  35.       Text            =   "Text1"
  36.       Top             =   8160
  37.       Visible         =   0   'False
  38.       Width           =   972
  39.    End
  40.    Begin VB.TextBox DDED 
  41.       Appearance      =   0  'Flat
  42.       Height          =   612
  43.       Left            =   288
  44.       TabIndex        =   17
  45.       Text            =   "Text1"
  46.       Top             =   7296
  47.       Visible         =   0   'False
  48.       Width           =   972
  49.    End
  50.    Begin VB.TextBox ddedd 
  51.       Appearance      =   0  'Flat
  52.       Height          =   612
  53.       Left            =   1248
  54.       TabIndex        =   16
  55.       Text            =   "Text1"
  56.       Top             =   8352
  57.       Visible         =   0   'False
  58.       Width           =   972
  59.    End
  60.    Begin VB.Frame Frame1 
  61.       Caption         =   "Info..."
  62.       Height          =   588
  63.       Left            =   192
  64.       TabIndex        =   11
  65.       Top             =   6144
  66.       Width           =   5772
  67.       Begin VB.Label infotab 
  68.          Alignment       =   2  'Center
  69.          Caption         =   "Enter The Message You Wish To Send"
  70.          BeginProperty Font 
  71.             name            =   "Arial"
  72.             charset         =   0
  73.             weight          =   700
  74.             size            =   10.2
  75.             underline       =   0   'False
  76.             italic          =   0   'False
  77.             strikethrough   =   0   'False
  78.          EndProperty
  79.          Height          =   300
  80.          Left            =   96
  81.          TabIndex        =   12
  82.          Top             =   192
  83.          Width           =   5580
  84.       End
  85.    End
  86.    Begin VB.TextBox DDEDDD 
  87.       Appearance      =   0  'Flat
  88.       Height          =   612
  89.       Left            =   96
  90.       TabIndex        =   1
  91.       Text            =   "Text1"
  92.       Top             =   9216
  93.       Visible         =   0   'False
  94.       Width           =   972
  95.    End
  96.    Begin VB.TextBox DDEDDDD 
  97.       Appearance      =   0  'Flat
  98.       Height          =   612
  99.       Left            =   1152
  100.       TabIndex        =   2
  101.       Text            =   "Text1"
  102.       Top             =   9216
  103.       Visible         =   0   'False
  104.       Width           =   972
  105.    End
  106.    Begin TabDlg.SSTab SSTab1 
  107.       Height          =   6924
  108.       Left            =   0
  109.       TabIndex        =   3
  110.       Tag             =   "Enter your message you wish to send."
  111.       Top             =   0
  112.       Width           =   6252
  113.       _Version        =   65536
  114.       _ExtentX        =   11028
  115.       _ExtentY        =   12213
  116.       _StockProps     =   15
  117.       Caption         =   "Message"
  118.       BackColor       =   12632256
  119.       TabsPerRow      =   5
  120.       Tab             =   0
  121.       TabOrientation  =   0
  122.       Tabs            =   4
  123.       Style           =   0
  124.       TabMaxWidth     =   0
  125.       TabHeight       =   423
  126.       TabCaption(0)   =   "Message"
  127.       Tab(0).ControlCount=   1
  128.       Tab(0).ControlEnabled=   -1  'True
  129.       Tab(0).Control(0)=   "DATUM"
  130.       TabCaption(1)   =   "Address"
  131.       Tab(1).ControlCount=   1
  132.       Tab(1).ControlEnabled=   0   'False
  133.       Tab(1).Control(0)=   "out1"
  134.       TabCaption(2)   =   "Sound"
  135.       Tab(2).ControlCount=   1
  136.       Tab(2).ControlEnabled=   0   'False
  137.       Tab(2).Control(0)=   "SSTab2"
  138.       TabCaption(3)   =   "Send It"
  139.       Tab(3).ControlCount=   4
  140.       Tab(3).ControlEnabled=   0   'False
  141.       Tab(3).Control(0)=   "Frame3"
  142.       Tab(3).Control(1)=   "SendingTo"
  143.       Tab(3).Control(2)=   "SendIt"
  144.       Tab(3).Control(3)=   "Frame2"
  145.       Begin VB.Frame Frame3 
  146.          Height          =   972
  147.          Left            =   -74520
  148.          TabIndex        =   26
  149.          Top             =   672
  150.          Width           =   5388
  151.          Begin Threed.SSCheck REPLYREQ 
  152.             Height          =   588
  153.             Left            =   672
  154.             TabIndex        =   27
  155.             Top             =   288
  156.             Width           =   4080
  157.             _Version        =   65536
  158.             _ExtentX        =   7197
  159.             _ExtentY        =   1037
  160.             _StockProps     =   78
  161.             Caption         =   "Reply Required ?"
  162.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  163.                name            =   "Arial"
  164.                charset         =   0
  165.                weight          =   700
  166.                size            =   22.2
  167.                underline       =   0   'False
  168.                italic          =   0   'False
  169.                strikethrough   =   0   'False
  170.             EndProperty
  171.          End
  172.       End
  173.       Begin VB.Frame SendingTo 
  174.          Caption         =   "Sending Information..."
  175.          BeginProperty Font 
  176.             name            =   "Arial"
  177.             charset         =   0
  178.             weight          =   700
  179.             size            =   16.2
  180.             underline       =   0   'False
  181.             italic          =   0   'False
  182.             strikethrough   =   0   'False
  183.          EndProperty
  184.          ForeColor       =   &H000000FF&
  185.          Height          =   2700
  186.          Left            =   -74520
  187.          TabIndex        =   20
  188.          Top             =   3072
  189.          Width           =   5388
  190.          Begin VB.Label Progress 
  191.             Alignment       =   1  'Right Justify
  192.             BackStyle       =   0  'Transparent
  193.             BorderStyle     =   1  'Fixed Single
  194.             BeginProperty Font 
  195.                name            =   "Arial"
  196.                charset         =   0
  197.                weight          =   700
  198.                size            =   24
  199.                underline       =   0   'False
  200.                italic          =   0   'False
  201.                strikethrough   =   0   'False
  202.             EndProperty
  203.             Height          =   588
  204.             Left            =   288
  205.             TabIndex        =   23
  206.             Top             =   1920
  207.             Width           =   4812
  208.          End
  209.          Begin VB.Label SENDUSER 
  210.             Alignment       =   1  'Right Justify
  211.             BackStyle       =   0  'Transparent
  212.             BorderStyle     =   1  'Fixed Single
  213.             BeginProperty Font 
  214.                name            =   "Arial"
  215.                charset         =   0
  216.                weight          =   700
  217.                size            =   24
  218.                underline       =   0   'False
  219.                italic          =   0   'False
  220.                strikethrough   =   0   'False
  221.             EndProperty
  222.             Height          =   588
  223.             Left            =   288
  224.             TabIndex        =   22
  225.             Top             =   1248
  226.             Width           =   4812
  227.          End
  228.          Begin VB.Label SENDDEPARTMENT 
  229.             BackStyle       =   0  'Transparent
  230.             BorderStyle     =   1  'Fixed Single
  231.             BeginProperty Font 
  232.                name            =   "Arial"
  233.                charset         =   0
  234.                weight          =   700
  235.                size            =   18
  236.                underline       =   0   'False
  237.                italic          =   0   'False
  238.                strikethrough   =   0   'False
  239.             EndProperty
  240.             Height          =   588
  241.             Left            =   288
  242.             TabIndex        =   21
  243.             Top             =   576
  244.             Width           =   4812
  245.          End
  246.       End
  247.       Begin VB.CommandButton SendIt 
  248.          Caption         =   "Send"
  249.          BeginProperty Font 
  250.             name            =   "Arial"
  251.             charset         =   0
  252.             weight          =   700
  253.             size            =   16.2
  254.             underline       =   0   'False
  255.             italic          =   0   'False
  256.             strikethrough   =   0   'False
  257.          EndProperty
  258.          Height          =   780
  259.          Left            =   -74424
  260.          TabIndex        =   19
  261.          Top             =   1920
  262.          Width           =   5100
  263.       End
  264.       Begin VB.TextBox DATUM 
  265.          BackColor       =   &H0000FFFF&
  266.          BeginProperty Font 
  267.             name            =   "Arial"
  268.             charset         =   0
  269.             weight          =   700
  270.             size            =   13.8
  271.             underline       =   0   'False
  272.             italic          =   0   'False
  273.             strikethrough   =   0   'False
  274.          EndProperty
  275.          Height          =   5388
  276.          Left            =   288
  277.          MultiLine       =   -1  'True
  278.          ScrollBars      =   2  'Vertical
  279.          TabIndex        =   0
  280.          Text            =   "POSTITSE.frx":030A
  281.          Top             =   576
  282.          Width           =   5580
  283.       End
  284.       Begin TabDlg.SSTab SSTab2 
  285.          Height          =   5484
  286.          Left            =   -74808
  287.          TabIndex        =   4
  288.          Top             =   576
  289.          Width           =   5772
  290.          _Version        =   65536
  291.          _ExtentX        =   10181
  292.          _ExtentY        =   9673
  293.          _StockProps     =   15
  294.          Caption         =   "Custom Sounds"
  295.          BackColor       =   12632256
  296.          TabsPerRow      =   3
  297.          Tab             =   1
  298.          TabOrientation  =   0
  299.          Tabs            =   2
  300.          Style           =   0
  301.          TabMaxWidth     =   0
  302.          TabHeight       =   423
  303.          TabCaption(0)   =   "Standard Sounds"
  304.          Tab(0).ControlCount=   6
  305.          Tab(0).ControlEnabled=   0   'False
  306.          Tab(0).Control(0)=   "Popup(5)"
  307.          Tab(0).Control(1)=   "Popup(4)"
  308.          Tab(0).Control(2)=   "Popup(3)"
  309.          Tab(0).Control(3)=   "Popup(2)"
  310.          Tab(0).Control(4)=   "Popup(1)"
  311.          Tab(0).Control(5)=   "Popup(0)"
  312.          TabCaption(1)   =   "Custom Sounds"
  313.          Tab(1).ControlCount=   2
  314.          Tab(1).ControlEnabled=   -1  'True
  315.          Tab(1).Control(0)=   "Command3D3"
  316.          Tab(1).Control(1)=   "File1"
  317.          Begin VB.FileListBox File1 
  318.             Archive         =   0   'False
  319.             BackColor       =   &H0000FFFF&
  320.             Enabled         =   0   'False
  321.             BeginProperty Font 
  322.                name            =   "Arial"
  323.                charset         =   0
  324.                weight          =   700
  325.                size            =   13.8
  326.                underline       =   0   'False
  327.                italic          =   0   'False
  328.                strikethrough   =   0   'False
  329.             EndProperty
  330.             Height          =   4260
  331.             Left            =   192
  332.             ReadOnly        =   0   'False
  333.             TabIndex        =   14
  334.             Top             =   384
  335.             Width           =   5388
  336.          End
  337.          Begin Threed.SSCommand Command3D3 
  338.             Height          =   348
  339.             Left            =   768
  340.             TabIndex        =   13
  341.             Top             =   4992
  342.             Width           =   4212
  343.             _Version        =   65536
  344.             _ExtentX        =   7430
  345.             _ExtentY        =   614
  346.             _StockProps     =   78
  347.             Caption         =   "Listen To It First"
  348.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  349.                name            =   "Arial"
  350.                charset         =   0
  351.                weight          =   700
  352.                size            =   12
  353.                underline       =   0   'False
  354.                italic          =   0   'False
  355.                strikethrough   =   0   'False
  356.             EndProperty
  357.          End
  358.          Begin Threed.SSOption Popup 
  359.             Height          =   396
  360.             Index           =   0
  361.             Left            =   -73464
  362.             TabIndex        =   10
  363.             Top             =   2688
  364.             Width           =   2892
  365.             _Version        =   65536
  366.             _ExtentX        =   5101
  367.             _ExtentY        =   699
  368.             _StockProps     =   78
  369.             Caption         =   "Popup"
  370.             ForeColor       =   255
  371.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  372.                name            =   "Arial"
  373.                charset         =   0
  374.                weight          =   700
  375.                size            =   18
  376.                underline       =   0   'False
  377.                italic          =   0   'False
  378.                strikethrough   =   0   'False
  379.             EndProperty
  380.             Value           =   -1  'True
  381.          End
  382.          Begin Threed.SSOption Popup 
  383.             Height          =   396
  384.             Index           =   1
  385.             Left            =   -73464
  386.             TabIndex        =   9
  387.             TabStop         =   0   'False
  388.             Top             =   1536
  389.             Width           =   3492
  390.             _Version        =   65536
  391.             _ExtentX        =   6160
  392.             _ExtentY        =   699
  393.             _StockProps     =   78
  394.             Caption         =   "Honk-Honk"
  395.             ForeColor       =   255
  396.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  397.                name            =   "Arial"
  398.                charset         =   0
  399.                weight          =   700
  400.                size            =   18
  401.                underline       =   0   'False
  402.                italic          =   0   'False
  403.                strikethrough   =   0   'False
  404.             EndProperty
  405.          End
  406.          Begin Threed.SSOption Popup 
  407.             Height          =   396
  408.             Index           =   2
  409.             Left            =   -73464
  410.             TabIndex        =   8
  411.             TabStop         =   0   'False
  412.             Top             =   3840
  413.             Width           =   3012
  414.             _Version        =   65536
  415.             _ExtentX        =   5313
  416.             _ExtentY        =   699
  417.             _StockProps     =   78
  418.             Caption         =   "Ship-Bell"
  419.             ForeColor       =   255
  420.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  421.                name            =   "Arial"
  422.                charset         =   0
  423.                weight          =   700
  424.                size            =   18
  425.                underline       =   0   'False
  426.                italic          =   0   'False
  427.                strikethrough   =   0   'False
  428.             EndProperty
  429.          End
  430.          Begin Threed.SSOption Popup 
  431.             Height          =   396
  432.             Index           =   3
  433.             Left            =   -73464
  434.             TabIndex        =   7
  435.             TabStop         =   0   'False
  436.             Top             =   960
  437.             Width           =   2436
  438.             _Version        =   65536
  439.             _ExtentX        =   4297
  440.             _ExtentY        =   699
  441.             _StockProps     =   78
  442.             Caption         =   "Bugle"
  443.             ForeColor       =   255
  444.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  445.                name            =   "Arial"
  446.                charset         =   0
  447.                weight          =   700
  448.                size            =   18
  449.                underline       =   0   'False
  450.                italic          =   0   'False
  451.                strikethrough   =   0   'False
  452.             EndProperty
  453.          End
  454.          Begin Threed.SSOption Popup 
  455.             Height          =   396
  456.             Index           =   4
  457.             Left            =   -73464
  458.             TabIndex        =   6
  459.             TabStop         =   0   'False
  460.             Top             =   3264
  461.             Width           =   2916
  462.             _Version        =   65536
  463.             _ExtentX        =   5144
  464.             _ExtentY        =   699
  465.             _StockProps     =   78
  466.             Caption         =   "Sickness"
  467.             ForeColor       =   255
  468.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  469.                name            =   "Arial"
  470.                charset         =   0
  471.                weight          =   700
  472.                size            =   18
  473.                underline       =   0   'False
  474.                italic          =   0   'False
  475.                strikethrough   =   0   'False
  476.             EndProperty
  477.          End
  478.          Begin Threed.SSOption Popup 
  479.             Height          =   396
  480.             Index           =   5
  481.             Left            =   -73464
  482.             TabIndex        =   5
  483.             TabStop         =   0   'False
  484.             Top             =   2112
  485.             Width           =   2724
  486.             _Version        =   65536
  487.             _ExtentX        =   4805
  488.             _ExtentY        =   699
  489.             _StockProps     =   78
  490.             Caption         =   "Kitten"
  491.             ForeColor       =   255
  492.             BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  493.                name            =   "Arial"
  494.                charset         =   0
  495.                weight          =   700
  496.                size            =   18
  497.                underline       =   0   'False
  498.                italic          =   0   'False
  499.                strikethrough   =   0   'False
  500.             EndProperty
  501.          End
  502.       End
  503.       Begin VB.Frame Frame2 
  504.          Caption         =   "User Instructions.."
  505.          BeginProperty Font 
  506.             name            =   "Arial"
  507.             charset         =   0
  508.             weight          =   700
  509.             size            =   16.2
  510.             underline       =   0   'False
  511.             italic          =   0   'False
  512.             strikethrough   =   0   'False
  513.          EndProperty
  514.          ForeColor       =   &H000000FF&
  515.          Height          =   2700
  516.          Left            =   -74520
  517.          TabIndex        =   24
  518.          Top             =   3072
  519.          Width           =   5388
  520.          Begin VB.Label Label1 
  521.             Alignment       =   2  'Center
  522.             Caption         =   $"POSTITSE.frx":031D
  523.             BeginProperty Font 
  524.                name            =   "Arial"
  525.                charset         =   0
  526.                weight          =   700
  527.                size            =   16.2
  528.                underline       =   0   'False
  529.                italic          =   -1  'True
  530.                strikethrough   =   0   'False
  531.             EndProperty
  532.             Height          =   2124
  533.             Left            =   192
  534.             TabIndex        =   25
  535.             Top             =   480
  536.             Width           =   5004
  537.          End
  538.       End
  539.       Begin MSOutl.Outline out1 
  540.          Height          =   5484
  541.          Left            =   -74712
  542.          TabIndex        =   15
  543.          Top             =   576
  544.          Width           =   5580
  545.          _Version        =   65536
  546.          _ExtentX        =   9843
  547.          _ExtentY        =   9673
  548.          _StockProps     =   77
  549.          ForeColor       =   0
  550.          BackColor       =   8454143
  551.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  552.             name            =   "Arial"
  553.             charset         =   0
  554.             weight          =   700
  555.             size            =   10.8
  556.             underline       =   0   'False
  557.             italic          =   0   'False
  558.             strikethrough   =   0   'False
  559.          EndProperty
  560.          MousePointer    =   1
  561.          Style           =   4
  562.          PicturePlus     =   "POSTITSE.frx":03B0
  563.          PictureMinus    =   "POSTITSE.frx":0522
  564.          PictureLeaf     =   "POSTITSE.frx":0694
  565.          PictureOpen     =   "POSTITSE.frx":0806
  566.          PictureClosed   =   "POSTITSE.frx":0978
  567.       End
  568.    End
  569. Attribute VB_Name = "postit"
  570. Attribute VB_Creatable = False
  571. Attribute VB_Exposed = False
  572. Private Function checkswear()
  573.     ' warning....
  574.     ' this function contains some horrible words - do not look if easily offended !
  575.     ' this functions purpose is to check the entire message for swear words, and returns
  576.     ' 0 if the message is clean, or not 0 if dirty.
  577.     D = UCase$(DATUM.Text) + " "
  578.     For A = 1 To Len(D)
  579.         C = C + UCase$(Mid$(D, A, 1))
  580.     Next A
  581.     D = " " + C
  582.     S = 0
  583.     If InStr(D, "ASSHOLE") > 0 Then S = 1
  584.     If InStr(D, "ASS HOLE") > 0 Then S = 1
  585.     If InStr(D, "ARSEHOLE") > 0 Then S = 1
  586.     If InStr(D, "ARSE HOLE") > 0 Then S = 1
  587.     If InStr(D, "BLOODY") > 0 Then S = 1
  588.     If InStr(D, "BASTARD") > 0 Then S = 1
  589.     If InStr(D, "PRICK") > 0 Then S = 1
  590.     If InStr(D, "PENIS") > 0 Then S = 1
  591.     If InStr(D, "SHIT") > 0 Then S = 1
  592.     If InStr(D, "FUCK") > 0 Then S = 1
  593.     If InStr(D, "BOLLOCKS") > 0 Then S = 1
  594.     If InStr(D, " PISS") > 0 Then S = 1
  595.     If InStr(D, "WANK ") > 0 Then S = 1
  596.     If InStr(D, "WANKER ") > 0 Then S = 1
  597.     If InStr(D, "WANKING ") > 0 Then S = 1
  598.     If InStr(D, "TODGER ") > 0 Then S = 1
  599.     If InStr(D, " ASS ") > 0 Then S = 1
  600.     If InStr(D, " ARSE ") > 0 Then S = 1
  601.     If InStr(D, "DICKHEAD") > 0 Then S = 1
  602.     If InStr(D, " SOD ") > 0 Then S = 1
  603.     If InStr(D, "VAGINA") > 0 Then S = 1
  604.     If InStr(D, " CLIT ") > 0 Then S = 1
  605.     If InStr(D, " CUNT ") > 0 Then S = 1
  606.     If UCase$(Environ$("WINNAME")) = UCase$(PN_SUPERVISOR) Then S = 0
  607.     checkswear = S
  608. End Function
  609. Private Sub Command3D3_Click()
  610.     ' this is the listen to custom sound button
  611.     Dim R As Integer
  612.     Const SYNC = 1
  613.      
  614.     ' obtain the proper file name
  615.     f = PN_SOUNDFILES + file1.filename
  616.     ' go play that sound
  617.     R = sndPlaySound(ByVal f, SYNC)
  618. End Sub
  619. Private Sub Form_Load()
  620.     ' center the form on the screen
  621.     Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
  622.     Dim Ds As Recordset
  623.     ' open the database (shared)
  624.     Set Db = OpenDatabase(PN_DATABASE, False)
  625.     ' get a list of all users on the system
  626.     SQL$ = "Select * From [Post It Notes] Order By Department,[User name]"
  627.     Set Ds = Db.OpenRecordset(SQL$, dbOpenSnapshot)
  628.     ' clear the address list, and then fill in the records
  629.     OUT1.Clear
  630.     ' add the first node
  631.     OUT1.AddItem PN_NETWORK, 0
  632.     C = 1    ' counter
  633.     Od = ""  ' old department name
  634.     ' loop through all the users, adding to the appropriate indentation level
  635.     ' on a change of department name, set od to the new department name
  636.     ' this stops recursion routines being needed !
  637.     While Not Ds.EOF
  638.         ' check if the name being processed is the name we were called with (reply mode)
  639.         If Ds.Fields("WINDOWS NAME") = GlobCmd Then GlobCmd = Ds.Fields("USER NAME")
  640.         If Ds.Fields("Department") <> Od Then
  641.             ' new department
  642.             ' add department at indent 1
  643.             OUT1.AddItem Ds.Fields("Department"), C
  644.             OUT1.Indent(C) = 1
  645.             C = C + 1
  646.             ' add user at indent 2
  647.             OUT1.AddItem Ds.Fields("User Name"), C
  648.             OUT1.Indent(C) = 2
  649.             C = C + 1
  650.             Od = Ds.Fields("Department")
  651.         Else
  652.             ' add user at indent 2
  653.             OUT1.AddItem Ds.Fields("User Name"), C
  654.             OUT1.Indent(C) = 2
  655.             C = C + 1
  656.         End If
  657.         ' next record
  658.         Ds.MoveNext
  659.     Wend
  660.     Ds.Close
  661.     ' go and expand all department nodes
  662.     For A = 0 To OUT1.ListCount - 1
  663.         
  664.         If OUT1.HasSubItems(A) Then OUT1.Expand(A) = True
  665.         
  666.     Next A
  667.     ' clear custom sound variable
  668.     GlobSound = ""
  669.     DATUM.Text = ""
  670.     ' AT THIS POINT, GLOBCMD WILL CONTAIN THE LONG NAME FOR THE USER.
  671.     If GlobCmd <> "" Then
  672.         
  673.         ' since we are in reply mode, we should change 'Send' to 'Reply'
  674.         sendit.Caption = "Reply"
  675.         
  676.         ' i think this code is obsolete, but i've left it in just in case  !
  677.         
  678.         ' find the user name
  679.         For A = 0 To (OUT1.ListCount - 1)
  680.             If OUT1.List(A) = GlobCmd Then
  681.                 Ind = A
  682.                 Exit For
  683.             End If
  684.         Next A
  685.         ' show it
  686.         OUT1.ListIndex = A
  687.         ' NEED TO FIND GROUP ABOVE...
  688.         For A = OUT1.ListIndex To 0 Step -1
  689.             If OUT1.Indent(A) = 1 Then
  690.                 OUT1.Expand(A) = True
  691.                 Exit For
  692.             End If
  693.         Next A
  694.               
  695.     End If
  696. End Sub
  697. Private Sub Form_Unload(Cancel As Integer)
  698.     ' close the database (global)
  699.     Db.Close
  700. End Sub
  701. Private Sub out1_Click()
  702.     ' handle expansion and contraction of the list box
  703.     If OUT1.HasSubItems(OUT1.ListIndex) Then
  704.         If OUT1.Expand(OUT1.ListIndex) Then
  705.         
  706.             OUT1.Expand(OUT1.ListIndex) = False
  707.             
  708.         Else
  709.         
  710.             OUT1.Expand(OUT1.ListIndex) = True
  711.             
  712.         End If
  713.         
  714.     End If
  715. End Sub
  716. Private Sub SENDIT_Click()
  717.     ' declare the snapshot variable (this should use recordset, but I haven't had time to alter it !)
  718.     Dim Ds As Recordset
  719.     ' if we have an item selected...
  720.     If OUT1.ListIndex <> -1 Then
  721.         ' check on the swearing content of the message
  722.         If checkswear() = 1 Then
  723.             A = MsgBox("Sorry I will not send that message - please clean up you language.", 16, "No Way!")
  724.             Exit Sub
  725.         End If
  726.         ' display the sending message panel
  727.         sendingto.Visible = True
  728.         DoEvents
  729.         ' IS THIS A SINGLE USER?
  730.         ' a system always has an indent of 0
  731.         ' a group always has an indent of 1
  732.         ' a user always has an indent of 2
  733.         
  734.       If OUT1.Indent(OUT1.ListIndex) = 2 Then
  735.             ' SINGLE USER.
  736.             
  737.             ' get the user address
  738.             SQL$ = "SELECT * FROM [POST IT NOTES] WHERE [USER NAME] = '" + OUT1.List(OUT1.ListIndex) + "'"
  739.             Set Ds = Db.OpenRecordset(SQL$, dbOpenSnapshot)
  740.             
  741.             ToName = Ds.Fields("WINDOWS NAME")
  742.             Department = Ds.Fields("DEPARTMENT")
  743.             Ds.Close
  744.                     
  745.             Progress.Caption = "Initiate"
  746.                     
  747.             ' go and send the message to the user
  748.             If SendMulti(ToName, Department) <> "OK" Then
  749.                     ' fail - user not logged on
  750.                     A = MsgBox("The message has been added to the message queue for that user", 64, "For Your Information")
  751.             Else
  752.                     ' message sent
  753.                     A = MsgBox("Your message has been sent to the requested person.", 64, "For Your information")
  754.             End If
  755.         
  756.         
  757.         Else
  758.             
  759.             ' IS THIS THE GLOBAL LIST ?
  760.             If OUT1.ListIndex = 0 Then
  761.                 ' YES, GLOBAL...
  762. '**********************************************************************************
  763. '**********************************************************************************
  764. '**********************************************************************************
  765.                 
  766.     ' This next section deals with the supervisor only group broadcast.
  767.     ' change the name to whoever is your supervisor
  768.     ' or change the code to whatever you like !
  769. '**********************************************************************************
  770. '**********************************************************************************
  771. '**********************************************************************************
  772. '**********************************************************************************
  773.                 ' do we have rights to do this ?
  774.                 If UCase$(Environ$("WinName")) <> UCase$(PN_SUPERVISOR) Then
  775.                     
  776.                     A = MsgBox("Sorry, But You Do Not Have Enough Rights To Send A Message To All Personnel.", 64, "For Your Information")
  777.                 Else
  778.                     
  779.                     ' get addresses (entire list)
  780.                     SQL$ = "SELECT * FROM [POST IT NOTES] ORDER BY DEPARTMENT,[USER NAME]"
  781.                     Set Ds = Db.OpenRecordset(SQL$, dbOpenSnapshot)
  782.                     
  783.                     ' loop through addresses, sending to all - note, no checking as to whether messages are actually sent here.
  784.                     While Not Ds.EOF
  785.                         
  786.                         ToName = Ds.Fields("WINDOWS NAME")
  787.                         Department = Ds.Fields("DEPARTMENT")
  788.                         Progress.Caption = "Initiate"
  789.                         DoEvents
  790.                         
  791.                         X = SendMulti(ToName, Department)
  792.                         Ds.MoveNext
  793.                     Wend
  794.                     Ds.Close
  795.                 End If
  796.             Else
  797.                 ' we are dealing with a group.
  798.                 ' THIS IS A GROUP.
  799.                 
  800.                 ' retrieve addresses for group
  801.                 SQL$ = "SELECT * FROM [POST IT NOTES] WHERE DEPARTMENT = '" + OUT1.List(OUT1.ListIndex) + "' ORDER BY [USER NAME]"
  802.                 Set Ds = Db.OpenRecordset(SQL$, dbOpenSnapshot)
  803.                 
  804.                 ' loop through and send messages to all users in a group
  805.                 While Not Ds.EOF
  806.                     
  807.                     ToName = Ds.Fields("WINDOWS NAME")
  808.                     Department = Ds.Fields("DEPARTMENT")
  809.                     Progress.Caption = "Initiate"
  810.                     DoEvents
  811.                     X = SendMulti(ToName, Department)
  812.                     Ds.MoveNext
  813.                 Wend
  814.                 Ds.Close
  815.             End If
  816.         End If
  817.         ' hide the send panel
  818.         sendingto.Visible = False
  819.         DoEvents
  820.     Else
  821.         
  822.         ' oops - didn't select a user in the address list.
  823.         A = MsgBox("Please Select A Person To Send This Message To !", 64, "Oops!")
  824.     End If
  825.     Progress.Caption = ""
  826. End Sub
  827. Private Function SendMulti(UserNam, Department)
  828.     SENDDEPARTMENT.Caption = ""
  829.     SENDUSER.Caption = ""
  830.     DoEvents
  831.     ' declare recordset variables
  832.     Dim NoteDS As Recordset
  833.     UserNam = Trim$(UserNam)
  834.     On Error Resume Next
  835.     ' set a double ampersand string to a single ampersand string
  836.     X = InStr(Department, "& ")
  837.     If X <> 0 Then
  838.         XX = Left$(Department, X)
  839.         XX = XX + "& "
  840.         XX = XX + Right$(Department, X + 1)
  841.         Department = XX
  842.     End If
  843.     SENDDEPARTMENT.Caption = Department
  844.     SENDUSER.Caption = UserNam
  845.     Progress.Caption = "Connect To Network"
  846.     DoEvents
  847.     EE = 0
  848.     Err = 0
  849.     ' repeat this loop 10 times - the other machine should have responded by then ! - if it hasn't, the machine is probably not logged on.
  850.     While (EE < 10)
  851.         DDE.LinkTopic = "\\" + UserNam + "\NDDE$|POSTIT"
  852.             
  853.         DDE.LinkItem = "CALLER"
  854.         DDE.LinkMode = 1
  855.         
  856.         If Err <> 0 Then
  857.             ' cancel the connection, add 1 to the retry count and try again
  858.             DDE.LinkMode = 0
  859.             EE = EE + 1
  860.         Else
  861.             ' we have a connection (this is quick and dirty code, should use boolean structures here)
  862.             EE = 99
  863.         End If
  864.         
  865.         ' reset the vb error code to clear.
  866.         Err = 0
  867.         
  868.     Wend
  869.             
  870.         If EE = 99 Then
  871.             Progress.Caption = "Start Send"
  872.             DoEvents
  873.             DDED.LinkTopic = "\\" + UserNam + "\NDDE$|POSTIT"
  874.             DDED.LinkItem = "DATUM"
  875.             DDED.LinkMode = 1
  876.             
  877.             DDEDD.LinkTopic = "\\" + UserNam + "\NDDE$|POSTIT"
  878.             DDEDD.LinkItem = "SOUNDER"
  879.             DDEDD.LinkMode = 1
  880.             
  881.             DDEDDD.LinkTopic = "\\" + UserNam + "\NDDE$|POSTIT"
  882.             DDEDDD.LinkItem = "NAMER"
  883.             DDEDDD.LinkMode = 1
  884.             
  885.             DDEDDDD.LinkTopic = "\\" + UserNam + "\NDDE$|POSTIT"
  886.             DDEDDDD.LinkItem = "RECORDID"
  887.             DDEDDDD.LinkMode = 1
  888.                 
  889.             For A = 0 To 6
  890.                 If POPUP(A).Value = True Then B = A
  891.             Next A
  892.             ' select standard sounds
  893.             Select Case B
  894.                 Case 0: Snd = "POPUP"
  895.                 Case 1: Snd = "HONKHONK"
  896.                 Case 2: Snd = "SHIPBELL"
  897.                 Case 3: Snd = "BUGLE"
  898.                 Case 4: Snd = "PUKE"
  899.                 Case 5: Snd = "KITTEN"
  900.                 Case 6: Snd = GlobSound
  901.             End Select
  902.                 
  903.             ' kludge
  904.             If B < 6 Then Snd = Snd + ".WAV"
  905.             
  906.              ' WRITE THE INFORMATION OUT TO A USER.
  907.             Progress.Caption = "Update Database"
  908.             DoEvents
  909.             
  910.             SQL$ = "SELECT * FROM NOTELOG"
  911.             Set NoteDS = Db.OpenRecordset(SQL$, dbOpenDynaset)
  912.             
  913.             On Error GoTo 0
  914.             NoteDS.AddNew
  915.             NoteDS.Fields("USERNAME") = UserNam
  916.             NoteDS.Fields("DATE") = Now
  917.             NoteDS.Fields("FROM") = UCase$(Environ$("USERNAME"))
  918.             NoteDS.Fields("MESSAGE") = DATUM.Text
  919.             NoteDS.Fields("SOUND") = PN_SOUNDFILES + Snd
  920.             NoteDS.Fields("READ") = False
  921.             If ReplyReq.Value = -1 Then NoteDS.Fields("REPLY_REQUIRED") = -1
  922.             NoteDS.Update
  923.             
  924.             On Error Resume Next
  925.             NoteDS.Bookmark = NoteDS.LastModified
  926.             DoEvents
  927.             
  928.             Progress.Caption = "Transfer Message"
  929.             DoEvents
  930.             
  931.             ' transfer the instructions over ndde to the other machine
  932.             DDEDDDD.Text = Str$(NoteDS.Fields("RECORD_ID"))
  933.             DDEDDDD.LinkPoke
  934.             DDEDDDD.LinkMode = 0
  935.             
  936.             ' close the recordset
  937.             NoteDS.Close
  938.             DDEDD.Text = PN_SOUNDFILES + Snd
  939.             DDEDD.LinkPoke
  940.             DDEDD.LinkMode = 0
  941.             
  942.             DDEDDD.Text = Environ$("WINNAME")
  943.             DDEDDD.LinkPoke
  944.             DDEDDD.LinkMode = 0
  945.             
  946.             DDE.Text = "From : " + Environ$("USERNAME")
  947.             DDE.LinkPoke
  948.             DDED.Text = DATUM.Text
  949.             DDED.LinkPoke
  950.             DDED.LinkMode = 0
  951.             DDE.LinkExecute ("OK")
  952.             DDE.LinkMode = 0
  953.                    
  954.         End If
  955.     ' decide what to return to the calling procedure
  956.     If EE = 99 Then
  957.         SendMulti = "OK"
  958.         Progress.Caption = "Complete - OK"
  959.             
  960.     Else
  961.         SendMulti = "error"
  962.         Progress.Caption = "Complete - FAIL"
  963.     End If
  964.             
  965.     DoEvents
  966. End Function
  967. Private Sub SSTab1_Click(PreviousTab As Integer)
  968.     ' set the info field up
  969.     Select Case SSTab1.Tab
  970.         
  971.         Case 0: infotab.Caption = "Enter The Message You Wish To Send"
  972.         Case 1: infotab.Caption = "Select The User Or Group Of Users To Send It To"
  973.         Case 2: infotab.Caption = "Select Either A Standard Or Custom Sound"
  974.         Case 3: infotab.Caption = "Select Any Message Options"
  975.         
  976.     End Select
  977.     DoEvents
  978. End Sub
  979. Private Sub SSTab2_Click(PreviousTab As Integer)
  980.     ' display the custom sounds - uses file list box.
  981.     If SSTab2.Tab = 1 Then
  982.         
  983.         postit.file1.Path = PN_SOUNDFILES
  984.         
  985.         postit.file1.Pattern = "*.WAV"
  986.         postit.file1.Enabled = True
  987.         
  988.         DoEvents
  989.         
  990.     End If
  991. End Sub
  992.