main.frm

来自「很好的教程原代码!」· FRM 代码 · 共 96 行

FRM
96
字号
VERSION 5.00
Begin VB.Form main 
   Caption         =   "信息发送程序"
   ClientHeight    =   3990
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7035
   LinkTopic       =   "Form1"
   ScaleHeight     =   3990
   ScaleWidth      =   7035
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   2280
      TabIndex        =   3
      Text            =   "Tex1"
      Top             =   960
      Width           =   2535
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   2280
      TabIndex        =   2
      Text            =   "Text2"
      Top             =   1500
      Width           =   2535
   End
   Begin VB.CommandButton Command1 
      Caption         =   "送 出"
      Height          =   375
      Left            =   5280
      TabIndex        =   1
      Top             =   960
      Width           =   1095
   End
   Begin VB.CommandButton Command2 
      Caption         =   "送 出"
      Height          =   375
      Left            =   5280
      TabIndex        =   0
      Top             =   1560
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "消息(WM_USER+1001)"
      Height          =   255
      Left            =   480
      TabIndex        =   5
      Top             =   1020
      Width           =   1935
   End
   Begin VB.Label Label2 
      Caption         =   "消息(WM_USER+1002)"
      Height          =   255
      Left            =   480
      TabIndex        =   4
      Top             =   1560
      Width           =   1935
   End
End
Attribute VB_Name = "main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
    Dim hWndRecv As Long, Priority As Long
    ' 设置线程优先级
    Priority = GetThreadPriority(GetCurrentThread)
    SetThreadPriority GetCurrentThread, 31
    ' 设置剪贴板内容
    Clipboard.SetText Text1.Text
    hWndRecv = FindWindow(vbNullString, "Receive - 资料接收者")
    ' 向接收端窗体发送消息
    SendMessage hWndRecv, WM_USER + 1001, 0, ByVal 0&
    ' 恢复优先级
    SetThreadPriority GetCurrentThread, Priority
End Sub

Private Sub Command2_Click()
    Dim hWndRecv As Long, Priority As Long
    ' 设置线程优先级
    Priority = GetThreadPriority(GetCurrentThread)
    SetThreadPriority GetCurrentThread, 31
    ' 设置剪贴板内容
    Clipboard.SetText Text2.Text
    hWndRecv = FindWindow(vbNullString, "Receive - 资料接收者")
    ' 向接收端窗体发送消息
    SendMessage hWndRecv, WM_USER + 1002, 0, ByVal 0&
    ' 恢复优先级
    SetThreadPriority GetCurrentThread, Priority
End Sub


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?