home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / CODIGO_1 / MSG_SPY / SPYDEMOP.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-05-26  |  16.5 KB  |  460 lines

  1. VERSION 2.00
  2. Begin Form frmMsgSpyDemoPro 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Message Spy VBX Demo (VB Pro)"
  6.    ClientHeight    =   5652
  7.    ClientLeft      =   180
  8.    ClientTop       =   1380
  9.    ClientWidth     =   4956
  10.    Height          =   6096
  11.    Icon            =   SPYDEMOP.FRX:0000
  12.    Left            =   120
  13.    LinkTopic       =   "Form2"
  14.    ScaleHeight     =   471
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   413
  17.    Tag             =   "This is the main form."
  18.    Top             =   996
  19.    Width           =   5076
  20.    Begin SSPanel pnl3dMCIStatus 
  21.       BackColor       =   &H00C0C0C0&
  22.       BevelOuter      =   1  'Inset
  23.       Font3D          =   0  'None
  24.       ForeColor       =   &H000000FF&
  25.       Height          =   252
  26.       Left            =   960
  27.       TabIndex        =   6
  28.       Tag             =   "This is the MCI control's status panel."
  29.       Top             =   3540
  30.       Width           =   2832
  31.    End
  32.    Begin MMControl MMControl1 
  33.       BackEnabled     =   -1  'True
  34.       EjectEnabled    =   -1  'True
  35.       Height          =   375
  36.       Left            =   540
  37.       NextEnabled     =   -1  'True
  38.       PauseEnabled    =   -1  'True
  39.       PlayEnabled     =   -1  'True
  40.       PrevEnabled     =   -1  'True
  41.       RecordEnabled   =   -1  'True
  42.       StepEnabled     =   -1  'True
  43.       StopEnabled     =   -1  'True
  44.       TabIndex        =   5
  45.       Tag             =   "This is an MCI control."
  46.       Top             =   3060
  47.       Width           =   3540
  48.    End
  49.    Begin MsgSpy MsgSpy1 
  50.       Left            =   1980
  51.       MessageNumber   =   1024
  52.       SpyMode         =   0  'All Messages
  53.       Tag             =   "This is a Message Spy control!"
  54.       Top             =   1440
  55.    End
  56.    Begin SSFrame Frame3D1 
  57.       Caption         =   "3D Frame"
  58.       Font3D          =   1  'Raised w/light shading
  59.       ForeColor       =   &H00FF0000&
  60.       Height          =   2472
  61.       Left            =   2460
  62.       ShadowStyle     =   1  'Raised
  63.       TabIndex        =   8
  64.       Tag             =   "This is a 3D frame."
  65.       Top             =   480
  66.       Width           =   2052
  67.       Begin OptionButton Option3 
  68.          BackColor       =   &H00C0C0C0&
  69.          Caption         =   "Radio button"
  70.          Height          =   375
  71.          Left            =   240
  72.          TabIndex        =   11
  73.          Tag             =   "This is the first radio button in the frame."
  74.          Top             =   1380
  75.          Value           =   -1  'True
  76.          Width           =   1455
  77.       End
  78.       Begin OptionButton Option4 
  79.          BackColor       =   &H00C0C0C0&
  80.          Caption         =   "Radio button"
  81.          Height          =   375
  82.          Left            =   240
  83.          TabIndex        =   12
  84.          Tag             =   "This is the second radio button in the frame."
  85.          Top             =   1920
  86.          Width           =   1455
  87.       End
  88.       Begin CheckBox Check2 
  89.          BackColor       =   &H00C0C0C0&
  90.          Caption         =   "Check Box"
  91.          Height          =   312
  92.          Left            =   240
  93.          TabIndex        =   10
  94.          Tag             =   "This is the second check box."
  95.          Top             =   900
  96.          Width           =   1572
  97.       End
  98.       Begin CheckBox Check1 
  99.          BackColor       =   &H00C0C0C0&
  100.          Caption         =   "Check Box"
  101.          Height          =   312
  102.          Left            =   240
  103.          TabIndex        =   9
  104.          Tag             =   "This is the first check box."
  105.          Top             =   360
  106.          Width           =   1572
  107.       End
  108.    End
  109.    Begin SSPanel pnl3dStatusArea 
  110.       BackColor       =   &H00C0C0C0&
  111.       Font3D          =   0  'None
  112.       ForeColor       =   &H00000000&
  113.       Height          =   1932
  114.       Left            =   -120
  115.       TabIndex        =   13
  116.       Top             =   3900
  117.       Width           =   5472
  118.       Begin SSPanel pnl3dControlTag 
  119.          BackColor       =   &H00C0C0C0&
  120.          BevelOuter      =   1  'Inset
  121.          Font3D          =   0  'None
  122.          FontBold        =   0   'False
  123.          FontItalic      =   0   'False
  124.          FontName        =   "MS Sans Serif"
  125.          FontSize        =   7.8
  126.          FontStrikethru  =   0   'False
  127.          FontUnderline   =   0   'False
  128.          ForeColor       =   &H00000000&
  129.          Height          =   240
  130.          Left            =   300
  131.          TabIndex        =   16
  132.          Top             =   480
  133.          Width           =   4548
  134.       End
  135.       Begin SSCheck chk3dTrackAll 
  136.          Caption         =   "Track &All Messages"
  137.          Font3D          =   0  'None
  138.          Height          =   195
  139.          Left            =   2760
  140.          TabIndex        =   15
  141.          Top             =   120
  142.          Width           =   1935
  143.       End
  144.       Begin SSCheck chk3dEnabled 
  145.          Caption         =   "&Spying Enabled"
  146.          Font3D          =   0  'None
  147.          Height          =   192
  148.          Left            =   720
  149.          TabIndex        =   14
  150.          Top             =   120
  151.          Value           =   -1  'True
  152.          Width           =   1752
  153.       End
  154.       Begin SSPanel pnl3dLParam 
  155.          BackColor       =   &H00C0C0C0&
  156.          BevelOuter      =   1  'Inset
  157.          Font3D          =   0  'None
  158.          FontBold        =   0   'False
  159.          FontItalic      =   0   'False
  160.          FontName        =   "MS Sans Serif"
  161.          FontSize        =   7.8
  162.          FontStrikethru  =   0   'False
  163.          FontUnderline   =   0   'False
  164.          ForeColor       =   &H00000000&
  165.          Height          =   240
  166.          Left            =   3180
  167.          TabIndex        =   23
  168.          Top             =   1320
  169.          Width           =   1665
  170.       End
  171.       Begin SSPanel pnl3dWParam 
  172.          BackColor       =   &H00C0C0C0&
  173.          BevelOuter      =   1  'Inset
  174.          Font3D          =   0  'None
  175.          FontBold        =   0   'False
  176.          FontItalic      =   0   'False
  177.          FontName        =   "MS Sans Serif"
  178.          FontSize        =   7.8
  179.          FontStrikethru  =   0   'False
  180.          FontUnderline   =   0   'False
  181.          ForeColor       =   &H00000000&
  182.          Height          =   240
  183.          Left            =   2220
  184.          TabIndex        =   22
  185.          Top             =   1320
  186.          Width           =   705
  187.       End
  188.       Begin SSPanel pnl3dMsg 
  189.          BackColor       =   &H00C0C0C0&
  190.          BevelOuter      =   1  'Inset
  191.          Font3D          =   0  'None
  192.          FontBold        =   0   'False
  193.          FontItalic      =   0   'False
  194.          FontName        =   "MS Sans Serif"
  195.          FontSize        =   7.8
  196.          FontStrikethru  =   0   'False
  197.          FontUnderline   =   0   'False
  198.          ForeColor       =   &H00000000&
  199.          Height          =   240
  200.          Left            =   1260
  201.          TabIndex        =   21
  202.          Top             =   1320
  203.          Width           =   705
  204.       End
  205.       Begin SSPanel pnl3dhWnd 
  206.          BackColor       =   &H00C0C0C0&
  207.          BevelOuter      =   1  'Inset
  208.          Font3D          =   0  'None
  209.          FontBold        =   0   'False
  210.          FontItalic      =   0   'False
  211.          FontName        =   "MS Sans Serif"
  212.          FontSize        =   7.8
  213.          FontStrikethru  =   0   'False
  214.          FontUnderline   =   0   'False
  215.          ForeColor       =   &H00000000&
  216.          Height          =   240
  217.          Left            =   300
  218.          TabIndex        =   20
  219.          Top             =   1320
  220.          Width           =   705
  221.       End
  222.       Begin SSPanel pnl3dYPos 
  223.          BackColor       =   &H00C0C0C0&
  224.          BevelOuter      =   1  'Inset
  225.          Font3D          =   0  'None
  226.          FontBold        =   0   'False
  227.          FontItalic      =   0   'False
  228.          FontName        =   "MS Sans Serif"
  229.          FontSize        =   7.8
  230.          FontStrikethru  =   0   'False
  231.          FontUnderline   =   0   'False
  232.          ForeColor       =   &H00000000&
  233.          Height          =   240
  234.          Left            =   4140
  235.          TabIndex        =   19
  236.          Top             =   900
  237.          Width           =   705
  238.       End
  239.       Begin SSPanel pnl3dXPos 
  240.          BackColor       =   &H00C0C0C0&
  241.          BevelOuter      =   1  'Inset
  242.          Font3D          =   0  'None
  243.          FontBold        =   0   'False
  244.          FontItalic      =   0   'False
  245.          FontName        =   "MS Sans Serif"
  246.          FontSize        =   7.8
  247.          FontStrikethru  =   0   'False
  248.          FontUnderline   =   0   'False
  249.          ForeColor       =   &H00000000&
  250.          Height          =   240
  251.          Left            =   3180
  252.          TabIndex        =   18
  253.          Top             =   900
  254.          Width           =   705
  255.       End
  256.       Begin SSPanel pnl3dMessage 
  257.          BackColor       =   &H00C0C0C0&
  258.          BevelOuter      =   1  'Inset
  259.          Font3D          =   0  'None
  260.          FontBold        =   0   'False
  261.          FontItalic      =   0   'False
  262.          FontName        =   "MS Sans Serif"
  263.          FontSize        =   7.8
  264.          FontStrikethru  =   0   'False
  265.          FontUnderline   =   0   'False
  266.          ForeColor       =   &H00000000&
  267.          Height          =   240
  268.          Left            =   300
  269.          TabIndex        =   17
  270.          Top             =   900
  271.          Width           =   2625
  272.       End
  273.    End
  274.    Begin OptionButton Option2 
  275.       BackColor       =   &H00C0C0C0&
  276.       Caption         =   "Radio button"
  277.       Height          =   375
  278.       Left            =   420
  279.       TabIndex        =   3
  280.       Tag             =   "This is the second radio button."
  281.       Top             =   1620
  282.       Width           =   1455
  283.    End
  284.    Begin SSPanel Panel3D1 
  285.       BackColor       =   &H00C0C0C0&
  286.       BevelOuter      =   1  'Inset
  287.       Caption         =   "3D Panel"
  288.       Font3D          =   0  'None
  289.       ForeColor       =   &H00000000&
  290.       Height          =   255
  291.       Left            =   2460
  292.       TabIndex        =   7
  293.       Tag             =   "This is a 3D panel."
  294.       Top             =   120
  295.       Width           =   2055
  296.    End
  297.    Begin TextBox Text1 
  298.       Height          =   285
  299.       Left            =   420
  300.       TabIndex        =   0
  301.       Tag             =   "This is a text box."
  302.       Text            =   "Text box"
  303.       Top             =   120
  304.       Width           =   1635
  305.    End
  306.    Begin ListBox List1 
  307.       Height          =   792
  308.       Left            =   420
  309.       TabIndex        =   4
  310.       Tag             =   "This is a list box."
  311.       Top             =   2160
  312.       Width           =   1632
  313.    End
  314.    Begin OptionButton Option1 
  315.       BackColor       =   &H00C0C0C0&
  316.       Caption         =   "Radio button"
  317.       Height          =   375
  318.       Left            =   420
  319.       TabIndex        =   2
  320.       Tag             =   "This is the first radio button."
  321.       Top             =   1080
  322.       Value           =   -1  'True
  323.       Width           =   1455
  324.    End
  325.    Begin CommandButton Command1 
  326.       Caption         =   "Command btn"
  327.       Height          =   375
  328.       Left            =   420
  329.       TabIndex        =   1
  330.       Tag             =   "This is a command button."
  331.       Top             =   540
  332.       Width           =   1635
  333.    End
  334. '-------------------------------------------------
  335. ' SpyDemoP - a Message Spy Custom Control demo
  336. ' (using VB Professional Edition VBX controls)
  337. ' Note the possible uses of the following
  338. ' properties within the MsgReceieved event:
  339. '   MessageName - the name of the message
  340. '   IsControl   - whether message is for a control
  341. '   Control     - the actual subclassed control!!!
  342. '   ControlName - the subclassed control's name
  343. '   IsForm      - whether message is for a form
  344. '   Form        - the actual subclassed form!!!
  345. '   FormName    - the subclassed form's name
  346. '   HIWORD      - like HIWORD(LParam) in C/C++
  347. '   LOWORD      - like LOWORD(LParam) in C/C++
  348. ' Copyright (c) 1992-1994 Anton Software Limited.
  349. '-------------------------------------------------
  350. Option Explicit
  351. ' Const WM_SETFOCUS = &H7
  352. ' Const WM_MOUSEMOVE = &H200
  353. ' These constants are not needed, as the message
  354. ' name is provided directly. Nevertheless, for
  355. ' production code, or if performance is a major
  356. ' issue, it would be better to use them instead.
  357. ' e.g.
  358. '   If (Msg = WM_SETFOCUS) Then
  359. '   instead of
  360. '   If (MsgSpy1.MessageName = "WM_SETFOCUS") Then
  361. Sub chk3dEnabled_Click (Value As Integer)
  362.     ' Enable/disable the Message Spy control.
  363.     MsgSpy1.Enabled = Value
  364. End Sub
  365. Sub DisplayMCIStatus (ByVal XPos As Integer)
  366.     Dim ButtonWidth As Integer
  367.     ButtonWidth = MMControl1.Width / 9
  368.     Select Case XPos
  369.         Case 0 To ButtonWidth - 1
  370.             pnl3dMCIStatus = "Previous"
  371.         Case ButtonWidth To (2 * ButtonWidth) - 1
  372.             pnl3dMCIStatus = "Next"
  373.         Case (2 * ButtonWidth) - 1 To (3 * ButtonWidth) - 1
  374.             pnl3dMCIStatus = "Play"
  375.         Case (3 * ButtonWidth) - 1 To (4 * ButtonWidth) - 1
  376.             pnl3dMCIStatus = "Pause"
  377.         Case (4 * ButtonWidth) - 1 To (5 * ButtonWidth) - 1
  378.             pnl3dMCIStatus = "Back"
  379.         Case (5 * ButtonWidth) - 1 To (6 * ButtonWidth) - 1
  380.             pnl3dMCIStatus = "Step"
  381.         Case (6 * ButtonWidth) - 1 To (7 * ButtonWidth) - 1
  382.             pnl3dMCIStatus = "Stop"
  383.         Case (7 * ButtonWidth) - 1 To (8 * ButtonWidth) - 1
  384.             pnl3dMCIStatus = "Record"
  385.         Case (8 * ButtonWidth) - 1 To (9 * ButtonWidth) - 1
  386.             pnl3dMCIStatus = "Eject"
  387.     End Select
  388. End Sub
  389. Sub Form_Load ()
  390.     ' Subclass ALL the controls on the form.
  391.     Dim i As Integer
  392.     For i = 0 To controls.Count - 1
  393.         MsgSpy1 = controls(i).hWnd
  394.     Next i
  395.     ' Subclass the form itself.
  396.     MsgSpy1 = frmMsgSpyDemoPro.hWnd
  397. End Sub
  398. Sub MsgSpy1_MsgReceived (hWnd As Integer, Msg As Integer, WParam As Integer, LParam As Long)
  399.     ' The control or form window name.
  400.     Dim WindowName As String
  401.     ' Save the message name.
  402.     Dim MessageName As String
  403.     MessageName = MsgSpy1.MessageName
  404.     ' If the message is for a control...
  405.     If MsgSpy1.IsControl Then
  406.         ' Save the control's name.
  407.         WindowName = MsgSpy1.ControlName
  408.         ' Process the message...
  409.         Select Case MessageName
  410.             Case "WM_SETFOCUS"
  411.                 ' Got focus message.
  412.                 pnl3dMessage = WindowName + " got focus"
  413.             Case "WM_MOUSEMOVE"
  414.                 ' Mouse is over the control.
  415.                 ' Display the control's name and
  416.                 ' the mouse coordinates.
  417.                 pnl3dMessage = "Mouse is over " & WindowName
  418.                 pnl3dXPos = Str$(MsgSpy1.LOWORD)
  419.                 pnl3dYPos = Str$(MsgSpy1.HIWORD)
  420.                 ' Display the control's Tag
  421.                 ' property.
  422.                 pnl3dControlTag.Caption = MsgSpy1.Control.Tag
  423.                 ' Process the MCI control.
  424.                 If TypeOf MsgSpy1.Control Is MMControl Then
  425.                     DisplayMCIStatus MsgSpy1.LOWORD
  426.                 Else
  427.                     pnl3dMCIStatus = ""
  428.                 End If
  429.         End Select
  430.     Else ' MsgSpy1.IsForm = True
  431.         ' Save the form's name.
  432.         WindowName = MsgSpy1.FormName
  433.         ' If the mouse is over the form...
  434.         If (MessageName = "WM_MOUSEMOVE") Then
  435.             ' Display the form's name and the
  436.             ' mouse coordinates.
  437.             pnl3dMessage = "Mouse is over " & WindowName
  438.             pnl3dXPos = Str$(MsgSpy1.LOWORD)
  439.             pnl3dYPos = Str$(MsgSpy1.HIWORD)
  440.             ' Display the form's Tag property.
  441.             pnl3dControlTag.Caption = MsgSpy1.Form.Tag
  442.             ' The mouse isn't over the MCI control.
  443.             pnl3dMCIStatus = ""
  444.         End If
  445.     End If
  446.     ' If all message are being tracked...
  447.     If chk3dTrackAll Then
  448.         ' Display the message (event) parameters.
  449.         pnl3dhWnd = Str$(hWnd)
  450.         pnl3dMsg = Str$(Msg)
  451.         pnl3dWParam = Str$(WParam)
  452.         pnl3dLParam = Str$(LParam)
  453.         ' Display the window and message details
  454.         ' in the debug window.
  455.         If MessageName <> "" Then
  456.             Debug.Print WindowName & ", " & MessageName & ", " & WParam & ", " & MsgSpy1.HIWORD & ", " & MsgSpy1.LOWORD
  457.         End If
  458.     End If
  459. End Sub
  460.