/native/external/espeak/platforms/windows/windows_sapi/ttseng.cpp

http://eyes-free.googlecode.com/ · C++ · 77 lines · 40 code · 21 blank · 16 comment · 5 complexity · 348df7b76e82d70181c1f1d68c6d5c62 MD5 · raw file

  1. // TtsEng.cpp : Implementation of DLL Exports.
  2. //Copyright (c) Microsoft Corporation. All rights reserved.
  3. // Note: Proxy/Stub Information
  4. // To build a separate proxy/stub DLL,
  5. // run nmake -f msttsdrvps.mk in the project directory.
  6. #include "stdafx.h"
  7. #include "resource.h"
  8. #include <initguid.h>
  9. #include "TtsEng.h"
  10. #include "TtsEng_i.c"
  11. #include "TtsEngObj.h"
  12. CComModule _Module;
  13. BEGIN_OBJECT_MAP(ObjectMap)
  14. OBJECT_ENTRY( CLSID_SampleTTSEngine , CTTSEngObj )
  15. END_OBJECT_MAP()
  16. /////////////////////////////////////////////////////////////////////////////
  17. // DLL Entry Point
  18. #ifdef _WIN32_WCE
  19. extern "C" BOOL WINAPI DllMain(HANDLE hInstance, ULONG dwReason, LPVOID)
  20. #else
  21. extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  22. #endif
  23. {
  24. if (dwReason == DLL_PROCESS_ATTACH)
  25. {
  26. _Module.Init(ObjectMap, (HINSTANCE)hInstance, &LIBID_SAMPLETTSENGLib);
  27. }
  28. else if (dwReason == DLL_PROCESS_DETACH)
  29. _Module.Term();
  30. return TRUE; // ok
  31. }
  32. /////////////////////////////////////////////////////////////////////////////
  33. // Used to determine whether the DLL can be unloaded by OLE
  34. STDAPI DllCanUnloadNow(void)
  35. {
  36. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  37. }
  38. /////////////////////////////////////////////////////////////////////////////
  39. // Returns a class factory to create an object of the requested type
  40. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  41. {
  42. return _Module.GetClassObject(rclsid, riid, ppv);
  43. }
  44. /////////////////////////////////////////////////////////////////////////////
  45. // DllRegisterServer - Adds entries to the system registry
  46. STDAPI DllRegisterServer(void)
  47. {
  48. // registers object, typelib and all interfaces in typelib
  49. return _Module.RegisterServer(TRUE);
  50. }
  51. /////////////////////////////////////////////////////////////////////////////
  52. // DllUnregisterServer - Removes entries from the system registry
  53. STDAPI DllUnregisterServer(void)
  54. {
  55. return _Module.UnregisterServer(TRUE);
  56. }