Compartir a través de


Sending Messages to the Win32 API with Visual Basic 6

Sending Messages to the Win32 API with Visual Basic 6

Description of sending messages to the WIN32 API with Visual Basic 6.

The Microsoft® ActiveX® version of InkEdit does not provide the complete RichTextBox Leave Siteapplication programming interface (API) as does the .NET version of InkEdit. However, the missing API members are available by sending window messages, which the ActiveX InkEdit forwards to its underlying RichEdit Leave Site control.

Win32 Messages

You can use the following guidelines to send Win32 messages from the InkEdit control.

  1. Declare constants for message IDs. For example:

    Private const EM_CANUNDO = &HC6 
    

    Constants can be retrieved from the API Viewer tool in Visual Studio.

  2. Map the Win32 SendMessage(hWnd, wMsg, wParam, IParam) function to a Visual Basic function. For example:

    Private Declare Function SendMessage Lib "user32" Alias _
     "SendMessageW"(ByVal hwnd As Long, ByVal wMsg As Long, _
     ByVal wParam As Long, lParam As Any) As Long
    
  3. Call SendMessage:

    Dim lres as Long
    Dim wp as Long
    Dim lp as Long
    wp = some_valid_value
    lp = some_valid_value
    lres = SendMessage(InkEdit1.hWnd, some_valid_messageID, wp, lp)
    

    For example, you can insert EM_CANUNDO as the some_valid_messageID argument.