Author | Message | Time |
---|---|---|
HdxBmx27 | 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. [code]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[/code] All of the constants are there proper formats, as far as I know: [code]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[/code] 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)~-~ | April 24, 2006, 3:59 PM |
JoeTheOdd | If you're just doing this for the non-scrolling effect (being discussed in this topic), then you can do it using the following code: [tt]Dim m_iCurrentPosition as Integer: m_iCurrentPosition = Z.SelStart AppendRTB Z, Color, Text, Color, Text Z.SelStart = m_iCurrentPosition[/tt] Otherwise, I don't know. | April 24, 2006, 10:09 PM |
warz | I think he's wanting to use SendMessage, not AppendRTB. Is there a SendDlgItemMessage in visual basic? | April 24, 2006, 10:13 PM |
HdxBmx27 | [quote author=warz link=topic=14841.msg151214#msg151214 date=1145916814] I think he's wanting to use SendMessage, not AppendRTB. Is there a SendDlgItemMessage in visual basic? [/quote] Yes, on both accounts. [code]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[/code] ~-~(HDX)~-~ | April 24, 2006, 10:20 PM |