Results 1 to 3 of 3

Thread: [RESOLVED] SendMessage EM_EXSETSEL problem

  1. #1

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Resolved [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.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    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
    Last edited by brucevde; Aug 14th, 2009 at 02:30 PM.

  3. #3

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: SendMessage EM_EXSETSEL problem

    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

    tx brucevde

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width