Visual Basic Core Snippet Routines
SendMessage
          
                 
   SendMessage sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message. This is the generic declare for SendMessage. Examples of call formats are listed in the Comments section below.          
           Updated:   Monday December 26, 2011   
click to copy code:  



   Applies to:   VB4-32, VB5, VB6   
OS restrictions:   None  
 Code Snippet
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright 1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce 
'               or publish this code on any web site,
'               online service, or distribute as source 
'               on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
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

 Calling Syntax
The calling syntax for SendMessage varies depending on the message being sent and the value passed as the lParam member of the call. Rather than attempt to outline all the caveats here, please see the pages below using SendMessage to pass the data types shown:  
  
Longs/Integers:  Changing Colours of a VB ProgressBar
Strings:  Finding Listbox Items Using SendMessage
Arrays:  Setting Tabstops in a Listbox Using SendMessage
User-defined Types:  SendMessage: Indent ListView ListItems

 Comments / Related
demo in use:  See API Index under 'S' for numerous examples.
      
Related:  PostMessage  

 
 

PayPal Link
Make payments with PayPal - it's fast, free and secure!

 
 
 
 

Copyright 1996-2011 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy

 

Hit Counter