Instantiating InkEdit

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

Visual Basic .NET and C#

If you are working with Microsoft Visual Basic .NET or C#, drag the InkEdit control from the Toolbox in Visual Studio to the form or page where you want the control 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 CreateWindow() 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 of 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 Multiline 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 RichEdit, 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 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.

Adding Ink Controls to a Project