1

我想动态绑定到windows sapi.dll,然后调用一些代码需要在windows上“说出”一些文本-下面的一些代码(这个片段是从desmond lang的gamedev.net文章中复制的)我没有经验使用 dll 的特别是 com。有人能告诉我这段代码应该如何为我工作吗?很多tnx

   // The voice interface pointer 
   IspVoice* Voice = NULL; 

   // Initialize COM 
   CoInitialize ( NULL ); 

   // Create the voice instance 
   CoCreateInstance ( CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void**)&Voice ); 

   // Our text to be spoken 
   WCHAR* TextBuffer = "Hello World"; 

   // Use our voice interface to speak the contents of the buffer 
   Voice -> Speak ( TextBuffer, SPF_DEFAULT, NULL ); 
4

0 回答 0