Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1068413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:17:05+00:00 2026-05-16T20:17:05+00:00

I’m trying to use use the LoadInk method of an mathinputcontrol but I can’t

  • 0

I’m trying to use use the LoadInk method of an mathinputcontrol but I can’t figure out where to create the IIDispInk object from, as it just appears to be an interface.

http://msdn.microsoft.com/en-us/library/dd372605(VS.85).aspx

Any guidance would be highly appreciated.

Thanks 🙂

Edit: for clarity, here is my code so far [edit 2: by “so far”, I mean of what’s been added. Pretty much all the rest of my code can be found on SO under how to create the MIC in C#] (thanks to Hans Passant)

MSINKAUTLib.InkDispClass loadInkTest = new MSINKAUTLib.InkDispClass();

Stream stream = File.Open("C:\\Tim\\bytes.isf", FileMode.Open);
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
loadInkTest.Load(bytes);


ctrl.LoadInk((micautLib.IInkDisp)loadInkTest);

Unfortunately this throws exactly the same exception

Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

C:\Tim\bytes.isf contain bytes saved from an InkPicture control which loads and saves this file file OK, so I assume that because the loadInkTest.Load() method did not throw an exception (normally it is not shy to do so) that it loaded the data OK. If there is a suggestion on a better (or more obvious) place to get the bytes, please let me know.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:17:06+00:00Added an answer on May 16, 2026 at 8:17 pm

    Use Project + Add Reference, Browse tab. Navigate to c:\program files\common files\microsoft shared\ink and select InkObj.dll. You can now create an instance of MSINKAUTLib.InkDispClass. It implements IInkDisp and has Save and Load methods.

    You will have to cast the object to micautLib.IInkDisp, the interfaces come from different type libraries. And the clincher, you have to call the MathInputControl’s Show() method first before using LoadInk(). Error reporting is miserable, everything is E_UNEXPECTED. The code I got to work:

            var ctl = new micautLib.MathInputControl();
            var ink = new MSINKAUTLib.InkDisp();
            ink.Load(System.IO.File.ReadAllBytes("c:\\temp\\test.isf"));
            var iink = (micautLib.IInkDisp)ink;
            ctl.Show();
            ctl.LoadInk(iink);
    

    Plus event handlers for the Insert and Close event. And the glue to get the window in the right place.

    Also beware that the micautLib type library has a dependency on the bit-ness of the machine. The troublemaker is the SetOwnerWindow() method, you really want to use it to prevent the dialog from disappearing behind another window. Its argument is declared as LONG_PTR, a type that is 32-bits on a 32-bit operating system, 64-bits on x64. The window handle. When you use Visual Studio, you will always get the 32-bit version of that method since VS is a 32-bit program.

    If you plan on supporting 64-bit operating systems then you will have to build a separate version of your program. Starting with running the 64-bit version of Tlbimp.exe (not Visual Studio) to create the interop wrapper. So that the argument will be a 64-bit value and compatible with the window Handle you pass to the method.

    Ah, the joys of COM. No real accident that this wasn’t wrapped by Microsoft.Ink.dll 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.