IJournalReader interface
Provides read access to a Windows Journal file, returning a stream containing an XML version of the file's contents.
Note
The Journal Reader component cannot read Windows Journal files created by machines running Windows 7 or later. The IJournalReader interface should be considered deprecated or obsolete and should not be used.
Members
The IJournalReader interface inherits from the IUnknown interface. IJournalReader also has these types of members:
Methods
The IJournalReader interface has these methods.
Method | Description |
---|---|
ReadFromStream | Takes a stream to a Journal Note file and returns an XML stream representing the contents of the document. |
Remarks
The JournalReader class enables you to load a Journal document stream and to receive an XML stream representing the contents. You can reconstitute, display, and manipulate the ink.
Examples
The following example of a handler for a button's Click event creates an instance of the JournalReader class and uses it to read an existing Journal file.
Note
The DisplayXml method called from this example is not shown. The specific implementation of such a method is dependent on your application's needs.
void CJntlReaderMFCDlg::OnBnClickedButton1()
{
static TCHAR BASED_CODE szFilter[] =
_T("Journal files (*.jnt)|*.jnt|All files (*.*)|*.*");
CFileDialog* fileDialog = new CFileDialog(TRUE, _T("*.jnt"), NULL,
OFN_FILEMUSTEXIST, szFilter, this);
// Get the filename from the user via a File Open dialog
if (fileDialog != NULL &&
fileDialog->DoModal() == IDOK)
{
CString strFileName = fileDialog->GetPathName();
// Read a JNT file into a memory buffer
HANDLE hFile = CreateFile(strFileName,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
// Allocate memory to hold the file contents
DWORD dwFileSize = GetFileSize(hFile, NULL);
HGLOBAL hGlobal = GlobalAlloc(GHND, dwFileSize);
if (hGlobal != NULL)
{
LPBYTE pData = (LPBYTE)GlobalLock(hGlobal);
if (pData != NULL)
{
DWORD dwRead;
// Read the Journal file into the pData buffer
if (ReadFile(hFile, pData, dwFileSize, &dwRead, NULL) &&
(dwRead == dwFileSize))
{
HRESULT hr;
IStream* pJntStream;
// Create an IStream that points to the buffer
hr = CreateStreamOnHGlobal(hGlobal, FALSE, &pJntStream);
if (SUCCEEDED(hr))
{
IJournalReader* pJntReader;
// Create a JournalReader object
hr = CoCreateInstance(CLSID_JournalReader, NULL, CLSCTX_ALL,
IID_IJournalReader, (void**)&pJntReader);
if (SUCCEEDED(hr))
{
IStream* pXmlStream;
// Read in the JNT file via the JournalReader
hr = pJntReader->ReadFromStream(pJntStream, &pXmlStream);
if (SUCCEEDED(hr))
{
// Display results
DisplayXml(pXmlStream);
// Clean up
pXmlStream->Release();
}
pJntReader->Release();
}
pJntStream->Release();
}
}
GlobalUnlock(hGlobal);
}
GlobalFree(hGlobal);
}
CloseHandle(hFile);
}
delete fileDialog;
}
}
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows XP Tablet PC Edition [desktop apps only] |
Minimum supported server |
None supported |
Header |
|
DLL |
|