home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 2.00 Begin Form Form1 BorderStyle = 3 'Fixed Double Caption = "MSlot VBX Sample" ClientHeight = 6615 ClientLeft = 1260 ClientTop = 2265 ClientWidth = 7590 Height = 7020 Left = 1200 LinkTopic = "Form1" ScaleHeight = 6615 ScaleWidth = 7590 Top = 1920 Width = 7710 Begin Frame Frame4 Caption = "Write Message" Height = 1815 Left = 3360 TabIndex = 24 Top = 2880 Width = 4095 Begin TextBox txtWriteMessage Height = 285 Left = 1320 TabIndex = 29 Text = "Test Message" Top = 720 Width = 2535 End Begin CommandButton btnWrite Caption = "Write Message to Mailslot" Height = 420 Left = 240 TabIndex = 27 Top = 1200 Width = 3615 End Begin TextBox txtWriteMailslotName Height = 285 Left = 1320 TabIndex = 25 Text = "\mailslot\atest" Top = 360 Width = 2535 End Begin Label Label4 Caption = "Message:" Height = 255 Left = 240 TabIndex = 0 Top = 720 Width = 975 End Begin Label Label1 Caption = "Name:" Height = 255 Left = 240 TabIndex = 26 Top = 360 Width = 975 End End Begin VBMailslots Mailslot1 Height = 420 Interval = 0 Left = 6480 MailslotName = "\mailslot\atest" MailslotSize = 1024 Message = "" MessageSize = 256 Priority = 1 Timeout = 2005 Top = 0 Width = 420 End Begin Frame Frame3 Caption = "User/Machine Information" Height = 1215 Left = 3360 TabIndex = 12 Top = 1560 Width = 4095 Begin Label lblWorkgroupName Caption = "lblWorkgroupName" Height = 255 Left = 1920 TabIndex = 18 Top = 840 Width = 1935 End Begin Label Label12 Caption = "Workgroup Name:" Height = 255 Left = 240 TabIndex = 17 Top = 840 Width = 1575 End Begin Label lblComputerName Caption = "lblComputerName" Height = 255 Left = 1920 TabIndex = 16 Top = 600 Width = 1935 End Begin Label Label11 Caption = "ComputerName:" Height = 255 Left = 240 TabIndex = 15 Top = 600 Width = 1575 End Begin Label lblUserName Caption = "lblUserName" Height = 255 Left = 1920 TabIndex = 14 Top = 360 Width = 1935 End Begin Label Label10 Caption = "User Name:" Height = 255 Left = 240 TabIndex = 13 Top = 360 Width = 1575 End End Begin Frame Frame2 Caption = "Mailslot Management" Height = 4575 Left = 120 TabIndex = 10 Top = 120 Width = 3015 Begin CommandButton btnDelete Caption = "Delete" Enabled = 0 'False Height = 420 Left = 1560 TabIndex = 23 Top = 960 Width = 1215 End Begin CommandButton btnMake Caption = "Make" Height = 420 Left = 240 TabIndex = 22 Top = 960 Width = 1215 End Begin TextBox txtMessage Enabled = 0 'False Height = 2055 Left = 240 MultiLine = -1 'True TabIndex = 21 Top = 1800 Width = 2535 End Begin CommandButton btnRead Caption = "Read Next Message" Enabled = 0 'False Height = 420 Left = 240 TabIndex = 19 Top = 3960 Width = 2535 End Begin TextBox txtMailslotName Height = 285 Left = 240 TabIndex = 11 Text = "\mailslot\atest" Top = 600 Width = 2535 End Begin Label Label2 Caption = "Message:" Enabled = 0 'False Height = 255 Left = 240 TabIndex = 20 Top = 1560 Width = 1095 End Begin Label Label9 Caption = "Name:" Height = 225 Left = 240 TabIndex = 3 Top = 360 Width = 1560 End End Begin Timer Timer1 Enabled = 0 'False Interval = 100 Left = 6960 Top = 0 End Begin Frame Frame1 Caption = "Peek (Next Message)" Height = 1215 Left = 3360 TabIndex = 5 Top = 240 Width = 4095 Begin Label Label8 Caption = "NextPriority:" Height = 270 Left = 240 TabIndex = 1 Top = 840 Width = 1035 End Begin Label Label7 Caption = "NextSize:" Height = 255 Left = 240 TabIndex = 2 Top = 600 Width = 960 End Begin Label Label6 Caption = "Message:" Height = 255 Left = 240 TabIndex = 9 Top = 360 Width = 1215 End Begin Label lblNextSize Caption = "lblNextSize" Height = 240 Left = 1920 TabIndex = 8 Top = 600 Width = 2055 End Begin Label lblNextPriority Caption = "lblNextPriority" Height = 240 Left = 1920 TabIndex = 7 Top = 840 Width = 2085 End Begin Label lblNextMessage Caption = "lblNextMessage" Height = 240 Left = 1920 TabIndex = 6 Top = 360 Width = 1965 End End Begin Label Label5 Caption = "You can run this program on two different machines. Use one machine to read the messages and use the other to write them. This makes a good test program for your applications that use MSlot VBX." Height = 735 Left = 120 TabIndex = 4 Top = 5760 Width = 7335 End Begin Label Label3 Caption = "Create a mailslot using the Mailslot Management Make button. Then, using the write message controls to write a message to this mailslot. Notice the change in the Peek (Next Message) fields. Finally, use the Read Next Message button to retrieve the message from the mailslot." Height = 855 Left = 120 TabIndex = 28 Top = 4800 Width = 7335 End Sub btnDelete_Click () ' shut down mailslot Timer1.Enabled = False Mailslot1.Action = MSLOT_DELETE ' re-enable the make stuff btnMake.Enabled = True txtMailslotName.Enabled = True ' reset display info Label2.Enabled = False txtMessage = "" txtMessage.Enabled = False btnDelete.Enabled = False btnRead.Enabled = False txtMailslotName.Enabled = True lblNextMessage = "N/A" lblNextSize = "N/A" lblNextPriority = "N/A" End Sub Sub btnMake_Click () ' make the mailslot Mailslot1.MailslotName = txtMailslotName Mailslot1.Action = MSLOT_OPEN ' make button and edit box are useless now btnMake.Enabled = False txtMailslotName.Enabled = False ' enable other controls Timer1.Enabled = True btnRead.Enabled = True btnDelete.Enabled = True Label2.Enabled = True txtMessage.Enabled = True End Sub Sub btnRead_Click () Mailslot1.Action = MSLOT_READ If txtMessage <> "" Then txtMessage = txtMessage & Chr(13) & Chr(10) End If txtMessage = txtMessage & Mailslot1.Message ' clear message buffer Mailslot1.Message = "" End Sub Sub btnWrite_Click () Mailslot1.MailslotName = txtWriteMailslotName Mailslot1.Message = txtWriteMessage Mailslot1.Action = MSLOT_WRITE End Sub Sub Form_Load () lblNextMessage = "N/A" lblNextSize = "N/A" lblNextPriority = "N/A" lblUserName = Mailslot1.UserName lblComputerName = Mailslot1.ComputerName lblWorkgroupName = Mailslot1.WorkgroupName End Sub Sub Timer1_Timer () Mailslot1.Action = MSLOT_PEEK ' make sure user can't read if no message waiting btnRead.Enabled = (Mailslot1.Message <> "") If Len(Mailslot1.Message) > 0 Then ' show data for waiting message lblNextMessage = Mailslot1.Message Else ' no message display lblNextMessage = "None" End If lblNextSize = Format(Mailslot1.NextSize) lblNextPriority = Format(Mailslot1.NextPriority) End Sub Sub txtMailslotName_Change () txtWriteMailslotName = txtMailslotName End Sub