2

I'm currently working on a TTS engine and my job is to make it compatible with Microsoft SAPI5. I followed the tutorial here a long with the SAPI sample projects and successfully built the engine dll. I registered the dll with regsvr32 and attached the voice into registry. However when an application (NVDA screen reader in my case) called my engine, I got the error (from NVDA log)

COMError: (-2147221164, 'Class not registered', (None, None, None, 0, None))

I obviously have done something wrong with the engine but I have no idea how I might debug this.

halfer
  • 19,824
  • 17
  • 99
  • 186
AtheS21
  • 523
  • 4
  • 11
  • Does your TTS engine work when called from another app (e.g., the [TTSApp](https://msdn.microsoft.com/en-us/library/ee125104(v=vs.85).aspx) sample)? That's a much simpler app to start with. – Eric Brown Apr 24 '17 at 16:17
  • I did try but no luck. It's the same error, class not registered. The thing is when I registered using regsvr32, it said "successfully". I'm totally lost here – AtheS21 Apr 24 '17 at 19:58

2 Answers2

0

You have to debug NVDA, not engine. You need to figure out which class does it try to access. Once you figure that out you need to check why you didn't properly register your engine in COM registry.

For more details see

Error 80040154 (Class not registered exception) when initializing VCProjectEngineObject (Microsoft.VisualStudio.VCProjectEngine.dll)

Community
  • 1
  • 1
Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
  • sorry for the late reply. According to my knowledge, the class here refer to the COM class that I implemented ISpTTSEngine and ISpObjectWithToken to work with sapi and I surely want to know why it hasn't been registered, because It IS successfully registered, at least as I was told. The issue might not be the case mentioned in your link because my engine's target is 32bit and the app (NVDA) does work with other 32bit engine (either way, I can't switch to x64 because I use some lib that only has 32bit version) – AtheS21 Apr 24 '17 at 20:26
  • Provide the output of dumpbin – Nikolay Shmyrev Apr 24 '17 at 20:40
  • You mean dumpbin of the dll? https://drive.google.com/file/d/0B8Aq_py2DfCBdGxWUTZJdzhTZFU/view?usp=sharing – AtheS21 Apr 25 '17 at 03:45
  • `dumpbin /exports` the answer says – Nikolay Shmyrev Apr 25 '17 at 06:29
  • https://drive.google.com/file/d/0B8Aq_py2DfCBWEVIU3NhWjNlZ3c/view?usp=sharing sorry i'm not really used to this so I thought /all should be good. – AtheS21 Apr 25 '17 at 06:37
  • It doesn't seem your SAPI methods are properly exported. Are you sure you added dllexport to all of them? – Nikolay Shmyrev Apr 25 '17 at 06:40
  • Now you need to register it again I presume. – Nikolay Shmyrev Apr 25 '17 at 13:02
  • I'm a little confused here, your statement made a lot of sense to me so I double check and saw that the sample engine from SAPI also exports those 4 default methods nothing more, and it still works The sample dll has no methods from sapi exported – AtheS21 Apr 25 '17 at 13:07
0

According to SAPI sample, in the idl file declared a library (with libid) and my engine class (with clsid), then there is a .rgs file which in turn will register the engine into registry, in my problem I did misplace the clsid with the libid, hence the engine is not registered properly.

AtheS21
  • 523
  • 4
  • 11