GFLRC/Sender/GFLRC_Senderfrm.frm
VERSION 5.00
Begin VB.Form GFLRC_Senderfrm
BorderStyle = 0 'Kein
Caption = "Form1"
ClientHeight = 90
ClientLeft = 0
ClientTop = 0
ClientWidth = 90
LinkTopic = "Form1"
ScaleHeight = 90
ScaleWidth = 90
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows‑Standard
End
Attribute VB_Name = "GFLRC_Senderfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'(c)2002 by Louis.
'
'NOTE: the GFLRC code can be used to exchange strings between two running applications.
'NOTE: GFLRC was created out of LRC code used in (god bless it) NN99.
'
'GFLRC_SendMessage
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
'GFLRC_SendMessage
Const WM_COPYDATA = &H4A
'GFLRC_SendMessage
Private Type COPYDATASTRUCT
dwData As Long
cbData As Long
lpData As Long
End Type
Public Function GFLRC_SendMessage(ByRef LRCData As String, ByVal LRCTargetPortName As String) As Boolean
'On Error Resume Next 'returns True if message has been sent, False if not
Dim LRCPortHandle As Long
Dim Temp As Long
Dim TempArrayByte() As Byte
Dim COPYDATASTRUCTVar As COPYDATASTRUCT
'begin
LRCPortHandle = FindWindow(vbNullString, LRCTargetPortName) 'find window with caption LRCLocalPortName
If Not ((LRCPortHandle = 0) Or (Len(LRCData) = 0)) Then 'verify
'STOLEN CODE ('PassString' from VBNet)
ReDim TempArrayByte(1 To Len(LRCData)) As Byte 'fit size of array to length of msg line to send
Call CopyMemory(TempArrayByte(1), ByVal LRCData, Len(LRCData))
With COPYDATASTRUCTVar
.dwData = 3
.cbData = Len(LRCData) 'important (length of LRCData)
.lpData = VarPtr(TempArrayByte(1))
End With
'END OF STOLEN CODE
Temp = SendMessage(LRCPortHandle, WM_COPYDATA, Me.hwnd, COPYDATASTRUCTVar)
If Not (Temp = 0) Then
GFLRC_SendMessage = True 'ok
Else
GFLRC_SendMessage = False 'error
End If
Else
GFLRC_SendMessage = False 'error
End If
End Function
[END OF FILE]