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 = &H400Const EM_HIDESELECTION As Long = (WM_USER + 63)
dim msg as new messagemsg.hWnd = mybase.handlemsg.wparam = new intptr(1)msg.lparam = intptr.zeromsg.msg = EM_HIDESELECTIONmybase.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 iti think that the problem in the Sendmessage itself! or in passing the arguments this way! ... please help????