Well, I kinda have a problem, I'm trying to append a rich text box, The text gets sent, but it is always the color of the background, so I can't see it.
How would you specify the color of the text when using SendMessage() to append it.
Dim X As CharFormat
X.cbSize = LenB(X)
X.crTextColor = vbRed
X.dwMask = CFM_COLOR
A = SendMessage(Z, WM_GETTEXTLENGTH, 0, 0) + 1
SendMessage Z, EM_SETSEL, A, 1
SendMessage Z, EM_SETCHARFORMAT, SCF_SELECTION, ByVal X
SendMessage Z, EM_REPLACESEL, 0, ByVal "Testing" & vbNewLine
SendMessage Z, EM_SCROLL, SB_LINEDOWN, 0
All of the constants are there proper formats, as far as I know:
Private Const WM_GETTEXTLENGTH As Long = &HE
Private Const EM_SETSEL& = &HB1
Private Const EM_REPLACESEL& = &HC2
Private Const EM_SCROLL& = &HB5
Private Const SB_LINEDOWN& = 1
Private Const SCF_SELECTION& = 1
Private Const EM_SETCHARFORMAT& = &H444
Private Const EM_GETCHARFORMAT& = &H43A
Private Const CFM_COLOR& = &H40000000
Private Type CharFormat
cbSize As Long
dwMask As Long
dwEffects As Long
yHeight As Long
yOffset As Long
crTextColor As Long
bCharSet As Byte
bPitchAndFamily As Byte
szFaceName(32) As Byte
End Type
Z of corse is the handle for the RTB.
But please, Don't think I don't know how to use .SelColor -.- its not the point of this program, the point is to do it via sendmessage, for experiance.
~-~(HDX)~-~
If you're just doing this for the non-scrolling effect (being discussed in this (http://forum.valhallalegends.com/index.php?topic=14819.new;boardseen#new) topic), then you can do it using the following code:
Dim m_iCurrentPosition as Integer: m_iCurrentPosition = Z.SelStart
AppendRTB Z, Color, Text, Color, Text
Z.SelStart = m_iCurrentPosition
Otherwise, I don't know.
I think he's wanting to use SendMessage, not AppendRTB.
Is there a SendDlgItemMessage (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/senddlgitemmessage.asp) in visual basic?
Quote from: warz on April 24, 2006, 05:13 PM
I think he's wanting to use SendMessage, not AppendRTB.
Is there a SendDlgItemMessage (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/senddlgitemmessage.asp) in visual basic?
Yes, on both accounts.
Private Declare Function SendDlgItemMessage Lib "user32" _
Alias "SendDlgItemMessageA" (ByVal hDlg As Integer, ByVal _
nIDDlgItem As Long, ByVal Msg As Long, ByVal wParam As Long, _
ByVal lParam As Any) As Long
~-~(HDX)~-~