Attribute VB_Name = "Module1"
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Public Const WM_CLOSE = &H10
Public Const SW_HIDE = 0
Public Const SW_SHOW = 5
Public Const WM_GETTEXT = &HD
Public Const WM_GETTEXTLENGTH = &HE
Public Const WM_SETTEXT = &HC
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Sub csend(texts As String)
IMWindowClass& = FindWindow("IMWindowClass", vbNullString)
RichEditA& = FindWindowEx(IMWindowClass&, 0&, "RichEdit20A", vbNullString)
RichEditA& = FindWindowEx(IMWindowClass&, RichEditA&, "RichEdit20A", vbNullString)
Call SendMessageByString(RichEditA&, WM_SETTEXT, 0&, texts)
IMWindowClass& = FindWindow("IMWindowClass", vbNullString)
Button& = FindWindowEx(IMWindowClass&, 0&, "Button", vbNullString)
Call PostMessage(Button&, WM_LBUTTONDOWN, 0&, 0&)
Call PostMessage(Button&, WM_LBUTTONUP, 0&, 0&)
IMWindowClass& = FindWindow("IMWindowClass", vbNullString)
End Sub
Function cget()
IMWindowClass& = FindWindow("IMWindowClass", vbNullString)
RichEditA& = FindWindowEx(IMWindowClass&, 0&, "RichEdit20A", vbNullString)
TextLen& = SendMessage(RichEditA&, WM_GETTEXTLENGTH, 0&, 0&)
RichEditATxt$ = String(TextLen&, 0&)
Call SendMessageByString(RichEditA&, WM_GETTEXT, TextLen& + 1&, RichEditATxt$)
cget = RichEditATxt$
End Function
Sub chide()
IMWindowClass& = FindWindow("IMWindowClass", vbNullString)
Call ShowWindow(IMWindowClass&, SW_HIDE)
End Sub
Sub cunhide()
IMWindowClass& = FindWindow("IMWindowClass", vbNullString)
Call ShowWindow(IMWindowClass&, SW_SHOW)
End Sub
Sub cclose()
IMWindowClass& = FindWindow("IMWindowClass", vbNullString)
Call SendMessage(IMWindowClass&, WM_CLOSE, 0&, 0&)
End Sub
