basic

basic

  • NA
  • 1
  • 0

PROBLEM: EM_HIDESELECTION, SendMessage

Mar 14 2006 7:08 PM

vb6-------------------------------------------------
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

Call SendMessage(RichTextBox1.hwnd, EM_HIDESELECTION, 1, ByVal 0&)
----------------------------------------------------
the previous code works just fine.


vb.net------------------------------------------------
Public Declare Auto Function SendMessage Lib "user32"  _
(ByVal hWnd As IntPtr, ByVal msg As Integer, _
ByVal wParam As Integer, ByVal lParam As Integer) As IntPtr


Public Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hwnd As Int32, _
ByVal wMsg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As Int32) As Int32

'this code is in derived class from RichTextBox Class.
SendMessage(MyBase.Handle.ToInt32,EM_HIDESELECTION, 1, 0)
SendMessage(MyBase.Handle, EM_SETSEL, Start, Start + Length)

----------------------------------------------------

the story is that, i want to select a current range from "Start" to "Start + Length" in a RichTextBox .. and i want to HIDE that SELECTION, and i want to hide that selection to remove the flickers from RTB of selecting and deselecting quickly ..

the ..
SendMessage(MyBase.Handle.ToInt32,EM_HIDESELECTION, 1, 0)
.. the previous call does not work or do anything while in VB6 it works fine...

another thing, it does not work too when i use WndProc method, like this:

Const WM_USER As Long = &H400
Const EM_HIDESELECTION As Long = (WM_USER + 63)

dim msg as new message
msg.hWnd = mybase.handle
msg.wparam = new intptr(1)
msg.lparam = intptr.zero
msg.msg = EM_HIDESELECTION
mybase.wndproc(msg)

' it does not WORK????????????

'note i am inharieting the RTB class in my own class control .. so i am using
'myBase word ...


one Another thing is that when i am using WndProc with EM_SETSEL message it fails and does not do anything, and it is successful when i use SendMessage Function with it
i think that the problem in the Sendmessage itself! or in passing the arguments this way! ... please help????