On this page
Recent Posts on Technozone
This site
Calendar
<July 2008>
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
Archives
Categories
Microsoft MVP
Blogroll OPML
Disclaimer

Powered by: newtelligence dasBlog 2.0.7226.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Craig Pringle

Based on the essence theme by Jelle Druyts

Trap for young (or tired) players#

If you are looking at developing tablet applications (and before you ask - yes you should be...) then there is a little trap that you should be aware of.

If you want to make use of the Ink Analysis API and you are developing on a 64-bit machine then make sure you set the target CPU to x86.  The Ink Analysis assemblies only support 32-bit at this time. 

If you forget to do this then when you build or debug the project on an 64-bit machine then you will get an error like this:

System.BadImageFormatException was unhandled
  Message=" is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)"
  Source="IACore"
  StackTrace:
       at System.Windows.Ink.AnalysisCore.RecognitionEngine..ctor(AnalysisWarningBaseCollection warnings)
       at System.Windows.Ink.AnalysisCore.RecognitionStage..ctor(AnalysisWarningBaseCollection warnings)
       at System.Windows.Ink.AnalysisCore.InkAnalyzerBase.CreateParserAndRegisterForEvents(Boolean reco)
       at System.Windows.Ink.AnalysisCore.InkAnalyzerBase.ForegroundAnalyzeInternal(ForegroundProcessingRecord record, AnalysisRegionBase dirty, AnalysisRegionBase originalDirtyRegion, Int32[] dirtyStrokesToAnalyze, AnalysisRegionBase dirtyRegionFromStrokesToAnalyze, AnalysisRegionBase regionOfRemovedStrokes)
       at System.Windows.Ink.AnalysisCore.InkAnalyzerBase.Analyze()
       at Microsoft.Ink.InkAnalyzer.Analyze()
       at InkBlogger.Form1.Button1_Click(Object sender, EventArgs e) in C:\Users\Craig Pringle\Documents\Visual Studio 2005\Projects\InkBlogger\InkBlogger\Form1.vb:line 21
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at InkBlogger.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

Which is not all that helpful...

To correct this you just need to set the target CPU in your project properties to x86.  To do this...

  1. right click you project in project explorer and select properties
  2. click on the Compile tab
  3. click on the Advanced Compile Options... button
  4. Set the target CPU as shown below.

image

What am I developing, you ask?  Time will tell ;-)

Wednesday, February 20, 2008 9:45:02 PM (AUS Eastern Standard Time, UTC+10:00) #   
Comments [0]  | 

 

All content © 2008, Craig Pringle