Private Declare Function CreateWindowEx Lib "user32" _
Alias "CreateWindowExA" (ByVal dwExStyle As Long, _
ByVal lpClassName As String, ByVal lpWindowName As String, _
ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, _
ByVal nWidth As Long, ByVal nHeight As Long, _
ByVal hWndParent As Long, ByVal hMenu As Long, _
ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function SetWindowText Lib "user32" _
Alias "SetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String) As Long
Private Declare Function DestroyWindow Lib "user32" _
(ByVal hwnd As Long) 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 Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String, ByVal cch As Long) As Long
Private Const ES_LEFT = &H0&
Private Const ES_MULTILINE = &H4&
Private Const ES_NOHIDESEL = &H100&
Private Const EM_GETLINECOUNT = &HBA
Private Const EM_GETLINE = &HC4
Private Const EM_LINEINDEX = &HBB
Private Const EM_SETSEL = &HB1
Private Const EM_GETSEL = &HB0
Private Const EM_LINELENGTH = &HC1
Private Const EM_REPLACESEL = &HC2
Private Const EM_LINEFROMCHAR = &HC9
Private tmphWnd As Long
Private tmpText As String
Private tmpOText As String
Private tmpBuffer As Long
Private tmpCaseSens As Boolean
Private tmpDelimeter As String
Private Sub Class_Initialize()
tmphWnd = CreateWindowEx(0, "Edit", "", _
ES_NOHIDESEL Or ES_LEFT Or ES_MULTILINE, _
0, 0, 100, 100, 0, 0, App.hInstance, ByVal 0&)
tmpBuffer = 2048
tmpCaseSens = False
tmpDelimeter = " "
End Sub
Private Sub Class_Terminate()
DestroyWindow tmphWnd
End Sub
Public Property Get hwnd() As Long
hwnd = tmphWnd
End Property
Public Property Get InText() As String
Text = tmpText
End Property
Public Property Let InText(ByVal vNewValue As String)
tmpText = vNewValue
tmpOText = vNewValue
tmpText = Replace(tmpText, tmpDelimeter, vbCrLf)
SetWindowText tmphWnd, tmpText
End Property
Public Property Get OutText() As String
Dim t As String
t = Space(tmpBuffer)
GetWindowText tmphWnd, t, tmpBuffer
OutText = Replace(t, vbCrLf, tmpDelimeter)
End Property
Public Property Get Textbuffer() As Long
Textpuffer = tmpBuffer
End Property
Public Property Let Textbuffer(ByVal vNewValue As Long)
If vNewValue = 0 Then Exit Property
If vNewValue > 65530 Then vNewValue = 65530
tmpBuffer = vNewValue
End Property 0 |