[RESOLVED] SendMessage EM_EXSETSEL problem
Hai folks,
the EM_EXSETSEL expects a CHARRANGE Structure in the lparam.
now i dont no how to use this EM_EXSETSEL with CHARRANGE in sendmessage.
this does not work, type mistmatch since the sendmessage() last para i have is long.
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Code:
Dim cr As CharRange
cr.cpMin = 0
cr.cpMax = -1
SendMessage wnd, EM_EXSETSEL, 0&, cr ' here cr is marked as type misedmatch.
pls kindly give the correct format.
pls help.
Re: SendMessage EM_EXSETSEL problem
UDT/Structures must be passed ByRef and the argument either declared As Any or as the specific UDT name.
Code:
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 SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As CharRange) As Long
If you need the SendMessage function declared in a specific way for other messages, you can add another declaration with a different function name
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function SendCharRangeMsg Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
SendCharRangeMsg wnd, EM_EXSETSEL, 0&, cr
Re: SendMessage EM_EXSETSEL problem
Quote:
UDT/Structures must be passed ByRef and the argument either declared As Any or as the specific UDT name.
very valuable piece of information this is for me :) :thumb:
tx brucevde