views:

34

answers:

1

Hi,

I'm trying to use MS IME on a server to retrieve some Japanese info in a silverlight app. The app accesses to the server by using WCF, but when calling a CoCreateInstance to create a IFELanguage2, it gives me -2147467262. The same code I'm using on the server actually works pretty fine on a WPF app.

Here is the code,

// ...omit
Guid imeGuid;
int errCode = Ole32.CLSIDFromString("MSIME.Japan", out imeGuid);
WinBase.CheckError(errCode);

Guid feLangIID = new Guid(Constants.IID_IFELanguage2);
IntPtr ppv;
errCode = Ole32.CoCreateInstance(imeGuid, IntPtr.Zero, Ole32.CLSCTX.CLSCTX_ALL, feLangIID, out ppv);
WinBase.CheckError(errCode);  // errCode is  2147467262
IFELanguage IfeLanguage = Marshal.GetTypedObjectForIUnknown(ppv, typeof(IFELanguage)) as IFELanguage;

errCode = IfeLanguage.Open();
WinBase.CheckError(errCode);
// ...omit

Do I need to setup anything to use the MS IME on a server side? I'm running the app on the following environment,
IIS7
.NET Framework 4.0
Windows 7 pro 64 bit
VS2010

Thanks in advance,
yokyo

A: 

After googling a half of a day, I got a bit further point. My problem was to call a com as MTA, so after changing to make a STA thread to call the com, CoCreateInstance doesn't bother me anymore.

Thanks

Yoo Matsuo

related questions