FujitsuStylistic.com

Installing the SDK


We'll assume that you have already downloaded the Tablet PC SDK. The downloaded file is probably titled 'Tablet PC Platform SDK v1.5.setup.exe.' Browse to the directory where you downloaded the file and run the setup file. There is nothing special about the SDK installation, but there are some steps to getting your development environment set up correctly.
When you start the installation, you are presented with an option to pick the items to install. You will probably want to install the samples of the SDK because they provide quick examples to many of the SDK features. In fact, if you have the space, it is advisable to install all of the optional components, as shown in Figure 12.1. These optional components also include the distributable merge module (Mstpcrt.msm) that can be redistributed with your applications. You only need this if you are building an application that needs to run on something besides a Tablet PC, such as a standard PC running Windows 2000 or Windows XP.
The rest of the setup is self-explanatory so we'll move on to setting up your development environment to utilize the SDK.
Note We'll assume that you install the SDK at the default path of C:\Program Files\Microsoft Tablet PC Platform SDK. You can choose any path you want, but we assume you are installing it to this path for the purposes of this text. Please remember the location of your path if you install it elsewhere.
Setting up Visual Studio .NET To build Tablet PC applications using either Visual C# or Microsoft Visual Basic .NET, you must add a reference to Microsoft Tablet PC API to your project in Visual Studio .NET (or use the InkEdit and InkPicture controls). This provides access to the Tablet PC managed object model. To add a reference to the SDK in Visual Studio .NET, perform the following steps:
On the Project menu, click Add Reference (see Figure 12.2).
Figure 12.2: Choose Add Reference from the Project menu.
On the .NET tab in the Add Reference dialog box, in the Component Name list, select Microsoft Ink Resources, version 1.0.2201.2. If you want to use the Divider or PenInputPanel objects in your application (you'll use these extensively later in the book but if you want, you can browse the SDK documention for additional information), you should also select Microsoft Ink Resources version 1.5.3023.0 (see Figure 12.3). These are commonly shortened to only the component names Microsoft Ink Resources and Microsoft Ink Resources 1.5.
Figure 12.3: You need to select the Tablet PC Components.
Click Select, and then click OK.
ActiveX and Managed Controls Microsoft was kind enough to include ActiveX counterparts for the managed InkEdit and InkPicture controls. These are perfect for users of the ever popular VB6. To build Tablet PC applications in Microsoft Visual Basic 6, you need to reference the Microsoft Tablet PC Type Library, version 1.0 (InkObj.dll), which is installed to the C:\Program Files\Common Files\Microsoft Shared\Ink folder by default. We look at the InkPicture and InkEdit managed components in Chapter 13, Introduction to Ink-Enabled Applications, as we use them to build applications.
There are a few additional things you need to do in order to use the control. First, you need to add the InkConstants.bas file, found in the same folder as the InkObj.dll file to your project. Now, to use the InkEdit ActiveX control in your application, you should right-click the Toolbox and select Components. Add a reference to the Microsoft InkEdit control version 1.0 (InkEd.dll), which should be located in the C:\Windows\System32 folder. Lastly, to use the InkDivider object, you need to create a reference in your project to the InkDiv.dll found in C:\Program Files\Common Files\Microsoft Shared\Ink folder by default.
Microsoft Visual C++ To build Tablet PC applications in Microsoft Visual C++®, you will need to update the system environment variables, set up directory options for Visual Studio, and access the Tablet PC interfaces in your project. Follow these steps to build Tablet PC programs:
Click the Start button and then click Control Panel.
If you are in the Classic View (see Figure 12.4), you need to double-click the System icon. On the other hand, if you are in Category View (see Figure 12.5), you should click the Performance and Maintenance icon first and then click the System icon.
Figure 12.4: The Control Panel in Classic View.
Figure 12.5: The Control Panel in Category View.
Choose the Advanced tab and then click the Environment Variables button. This displays an Environment Variables dialog box (see Figure 12.6).
Figure 12.6: The Environment Variables dialog box.
Under System variables in the Environment Variables dialog box, select Path, and then click Edit.
In the Edit System Variable dialog box, add ';%CommonProgramFiles%\Microsoft Shared\Ink' to the Variable value, and then click OK. This can go at the end of anything already existing and should be entered without the quotes.
Under System variables in the Environment Variables dialog box, select INCLUDE, and then click Edit.
In the Edit System Variable dialog box, add '; %ProgramFiles%\Microsoft Tablet PC Platform SDK\Include' to the Variable value, and then click OK. If you installed the SDK to another folder, you may need to alter the paths in the previous steps.
Click OK in the Environment Variables dialog box.
Click OK in the System Properties dialog box.
In Visual Studio, select the Tools menu and then click Options. In Visual Studio .NET, the Visual C++ Directories options are located under the Projects node.
On the Directories tab, in the Show directories for list, select Include files.
Under Directories (the Include Directories list in Visual Studio .NET), add '%ProgramFiles%\Microsoft Tablet PC Platform SDK\Include,' and then press Enter.
In the Show directories for list, select Library files.
Under Directories (the Library Directories list in Visual Studio .NET), add '%CommonProgramFiles%\Microsoft Shared\Ink,' and then press Enter. Click OK.
To access the Tablet PC interfaces, you must include the Msinkaut.h and Msinkaut_i.c files and to access the InkEdit control interfaces, you need to include Inked.h and Inked_i.c. in your project like the following:
#include #include #include #include Note You could use the following import directive instead of the first two #include statements: '#import "InkObj.dll" no_namespace exclude("tagXFORM")'.
The files we have been using are only a few of the many that are installed with the Tablet PC SDK. According to Microsoft documentation, there are over 160 files included with the SDK. We are not reviewing each of the files, but the following list details some of the more important ones:
Microsoft.Ink: Most of the managed API is implemented within this assembly.
InkObj.dll: This includes most of the core ink services used internally by the platform and includes the COM automation APIs and type libraries.
Tpcsdk10.chm: The help documentation for the SDK is available here.
MSInkAut.h: The main COM automation API header is available here to include in your C++ projects.
InkEd.dll: The InkEdit control is implemented in this dynamic-link library (DLL).
Wisptis.exe: This runs as a system service that provides pen-data collection for other components of the SDK. When a component needs to interact with the pen, this executable is spawned as a service to communicate directly with the input device. This interacts with the digitizer on a Tablet PC or a mouse on a desktop PC.