PDA

View Full Version : Tablet PC SDK & MFC - problem...



vintab
02-28-2003, 03:35 AM
hi...
I am facing a problem while using Tablet PC SDK in MFC project.
I made a simple dialog application in MFC, and to one of the Edit Box, attached a Ink functionalities.

On compilation, the program gives error:
error LNK2005: _DIID__IInkRecognitionEvents already defined in mfc.obj

I get above sort of error for all the DIID's and CLSID's
Any Idea? why such an error?

Also, other way round, I changed my Tools | Option settings, so as to match the MultiReco sample. On doing such a thing, the program gets successfully compiled, but the .exe terminates abnormally.
I get following msg.
...
Warning: Destroying non-NULL m_pMainWnd
The thread 0x378 has exited with code 0 (0x0).
The program 'C:\zTab\mfc\new\Debug\mfc.exe' has exited with code 0 (0x0).

I couldn't break through the problem...
Can anyone share out a soln. ASAP...
thanks...
vinTab...

SWick
02-28-2003, 08:24 AM
Hello vinTab,

you didn't make your scenario very clear, but I am assuming you are using VS.NET to create an MFC app with an EditBox that has a PenInputPanel attached. Please post again if this is not the case.

Here are the steps you need to do for a simple MFC app:
1) create new MFC project (select ApplicationType=Dialog-based)

2) place an EditBox on the dialog and add a variabe "m_edit" for the EditBox control

3) make sure you have \Program Files\Microsoft Tablet PC Platform SDK\Include in your include path

4) add the following code at the beginning of your *Dlg.cpp file:
#include "peninputpanel_i.c"
#include "peninputpanel.h"
CComPtr <IPenInputPanel> spPIP;

5) add the following code in OnInitDialog:
spPIP.CoCreateInstance(CLSID_PenInputPanel);
spPIP->put_AttachedEditWindow((LONG_PTR)m_edit.m_hWnd) ;

6) insert an OnClose handler and add the following code:
spPIP.Release();
CDialog::OnClose();

Then run your app and enjoy :-)

Thanks

vintab
02-28-2003, 06:14 PM
hi SWick...
I was trying out Tablet PC SDK v1.1, and so not using PenInputPanel as such.
First of all let me give you the background of my system installations...:
WinXP Tablet PC Edition,
VC6.0 with SP5
Also installed Platfrom SDK update (Core SDK & all...)
Copied the relevant files from Include, Lib & Bin directories in C:\Program Files\Microsoft SDK into the Include, Lib & Bin directories of VC6.0

Then proceeded towards making a small Tablet PC application...
The steps I followed were...
1.) Created a Dialog based Application through New Project (MFC App Wizard)
2.) Added a Editbox to the Dialog.
3.) Created a class:
class wTabletLayer :
public IInkCollectorEventsImpl<wTabletLayer>,
public IInkRecognitionEventsImpl<wTabletLayer>
{
public:
// Automation API interface pointers
CComPtr<IInkCollector> m_spIInkCollector;
....

}

All the CoCreateInstances & initialising of the Collector & Recognizers takes place in the wTabletLayer...
I have got a member function to associate it with the Dialog...
It takes in the handle of the Editbox & is associated to this HWND through m_spIInkCollector->put_hWnd()...

Now, there's another edit box...I intended to recognize the handwriting in the first edit box and throw the output into the second edit box...But...in vain...

The problems I faced were as I reported in the earlier post...

Thanks...
vinTab...

vintab
02-28-2003, 06:51 PM
hi SWick...
One more info. I need to add...
on running a simple Win32 app. or any other MFC..proj..
After the application is closed...I get the following msg. in the debug window...

...
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\user32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\gdi32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\advapi32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\MSCTF.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\MSCTFIME.IME', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\secur32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\clbcatq.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\oleaut32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\comres.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\version.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\mslbui.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\MSIMTF.dll', no matching symbolic information found.
Loaded 'D:\Program Files\Windows Journal\nbmaptip.dll', no matching symbolic information found.
Loaded 'D:\Program Files\Common Files\Microsoft Shared\Ink\tiptsf.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\shlwapi.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\ime\SPTIP.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\comctl32.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\oleacc.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\system32\msvcp60.dll', no matching symbolic information found.
Loaded 'D:\WINDOWS\ime\SPGRMR.dll', no matching symbolic information found.
Loaded 'D:\Program Files\Common Files\Microsoft Shared\Ink\TabTipps.dll', no matching symbolic information found.
The thread 0x634 has exited with code 0 (0x0).
The thread 0x434 has exited with code 0 (0x0).
The thread 0x6EC has exited with code 0 (0x0).
The thread 0x3D8 has exited with code 0 (0x0).
The program 'C:\zTab\vinApp\Debug\vinApp.exe' has exited with code 0 (0x0).


Hope this may provide you some idea about what the problem may be...

thanks...
vinTab...

SWick
03-01-2003, 03:15 AM
Hello vintab,

I have just created a simple MFC app using InkCollector in VC6 without hitting any issues. So let's try simple things first and follow the below steps:

1) create a new dialog-based MFC app in VC6

2) place an EditBox on the dialog and add a member variable "m_edit" of type CEdit via ClassWizzard

3) add the following code at the begining of *Dlg.cpp:
#include "atlbase.h"
#include "msinkaut_i.c"
#include "msinkaut.h"
CComPtr<IInkCollector> spInkCol;

4) add the following code in OnInitDialog:
spInkCol.CoCreateInstance(CLSID_InkCollector);
spInkCol->put_hWnd((long)m_edit.m_hWnd);
spInkCol->put_Enabled(VARIANT_TRUE);

5) add an OnClose handler with the following code:
spInkCol->put_Enabled(VARIANT_FALSE);
spInkCol.Release();
CDialog::OnClose();

Then run your app and verify that you can ink on the EditBox. As a next step add an InkRecognizerContext (look at "Basic Recognition" sample) and an event sink (look at "C++ Event Sinks" sample).