Compartir a través de


Instantiating InkEdit

Instantiating InkEdit

Description of instantiating InkEdit for the Tablet PC.

This topic describes the various ways that you can instantiate an InkEdit Control.

Visual Basic .NET, C#, and Visual Basic 6

If you are working with Microsoft® Visual Basic® .NET, C#, or Visual Basic 6.0, drag and drop the InkEdit from the Toolbox to the form or page where you want it to appear.

Win32/C++

The InkEdit control is a superclass of the Rich Edit 4.5 Win32 OLE embeddable control.

Win32 applications instantiate the InkEdit control by calling CreateWindowW() and passing INKEDIT as the window class. INKEDIT is defined in InkEd.h. After the control is created, you can "talk" to the control with messages. Rich Edit messages (EM_*) are passed from InkEdit to Rich Edit unaltered; all the existing Rich Edit functionality is available.

To create an InkEdit control, call the CreateWindow() function, specifying the InkEdit window class. Use LoadLibrary() to register InkEd.dll. Specify the INKEDIT_CLASS defined constant for the window class parameter and use the window styles as specified in the following examples.

Instantiating a Multi-Line InkEdit Control

//...
HMODULE s_hlib;
s_hlib= LoadLibrary("InkEd.dll");
//...
m_hwndInkEdit = CreateWindowW(INKEDIT_CLASS, NULL,
    WS_CHILD|WS_VISIBLE|WS_BORDER|ES_MULTILINE,
    rt.left, rt.top, rt.right, rt.bottom,
    m_hWnd, NULL, hInst, NULL);

Instantiating a Single-Line InkEdit Control

//...
HMODULE s_hlib;
s_hlib= LoadLibrary("InkEd.dll");
//...
m_hwndInkEdit = CreateWindowW(INKEDIT_CLASS, NULL,
    WS_CHILD|WS_VISIBLE|WS_BORDER,
    rt.left, rt.top, rt.right, rt.bottom,
    m_hWnd, NULL, hInst, NULL);

Note: Unlike with Rich Edit, you must be sure to call CoInitialize before creating the InkEdit control. Call CoUninitialize when your application shuts down. After calling CoUninitialize, you must call FreeLibrary(s_hlib) to decrement the reference count on the InkEdit.dll file.

If you use the ES_NOIME Leave Site window style, the built-in correction support is not available. If you don't specify a parent window, the control is created as a top-level window and the WS_SYSMENU style is added; this also disables the built-in correction support.