ifc_omconfig.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef NULLSOFT_WINAMP_OMBROWSER_CONFIG_INI_INTERFACE_HEADER
  2. #define NULLSOFT_WINAMP_OMBROWSER_CONFIG_INI_INTERFACE_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. // {73661787-0ACC-4692-B6A2-41D14E81A8CE}
  7. static const GUID IFC_OmConfig =
  8. { 0x73661787, 0xacc, 0x4692, { 0xb6, 0xa2, 0x41, 0xd1, 0x4e, 0x81, 0xa8, 0xce } };
  9. #include <bfc/dispatch.h>
  10. class ifc_omconfigcallback;
  11. class __declspec(novtable) ifc_omconfig : public Dispatchable
  12. {
  13. protected:
  14. ifc_omconfig() {}
  15. ~ifc_omconfig() {}
  16. public:
  17. HRESULT GetPath(wchar_t *pszBuffer, int cchBufferMax);
  18. DWORD ReadString(const wchar_t *lpSectionName, const wchar_t *lpKeyName, const wchar_t *lpDefault, wchar_t *lpReturnedString, DWORD nSize);
  19. UINT ReadInt(const wchar_t *lpSectionName, const wchar_t *lpKeyName, int nDefault);
  20. BOOL ReadBool(const wchar_t *lpSectionName, const wchar_t *lpKeyName, BOOL bDefault);
  21. HRESULT WriteString(const wchar_t *lpSectionName, const wchar_t *lpKeyName, const wchar_t * lpString);
  22. HRESULT WriteInt(const wchar_t *lpSectionName, const wchar_t *lpKeyName, int nValue);
  23. HRESULT WriteBool(const wchar_t *lpSectionName, const wchar_t *lpKeyName, BOOL bValue);
  24. HRESULT RegisterCallback(ifc_omconfigcallback *callback, unsigned int *cookie);
  25. HRESULT UnregisterCallback(unsigned int cookie);
  26. public:
  27. DISPATCH_CODES
  28. {
  29. API_GETPATH = 10,
  30. API_READSTRING = 20,
  31. API_READINT = 30,
  32. API_READBOOL = 40,
  33. API_WRITESTRING = 50,
  34. API_WRITEINT = 60,
  35. API_WRITEBOOL = 70,
  36. API_REGISTERCALLBACK = 80,
  37. API_UNREGISTERCALLBACK = 90,
  38. };
  39. };
  40. inline HRESULT ifc_omconfig::GetPath(LPWSTR pszBuffer, INT cchBufferMax)
  41. {
  42. return _call(API_GETPATH, (HRESULT)E_NOTIMPL, pszBuffer, cchBufferMax);
  43. }
  44. inline DWORD ifc_omconfig::ReadString(LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize)
  45. {
  46. return _call(API_READSTRING, (DWORD)0, lpSectionName, lpKeyName, lpDefault, lpReturnedString, nSize);
  47. }
  48. inline UINT ifc_omconfig::ReadInt(LPCWSTR lpSectionName, LPCWSTR lpKeyName, INT nDefault)
  49. {
  50. return _call(API_READINT, (UINT)0, lpSectionName, lpKeyName, nDefault);
  51. }
  52. inline BOOL ifc_omconfig::ReadBool(LPCWSTR lpSectionName, LPCWSTR lpKeyName, BOOL bDefault)
  53. {
  54. return _call(API_READBOOL, (BOOL)FALSE, lpSectionName, lpKeyName, bDefault);
  55. }
  56. inline HRESULT ifc_omconfig::WriteString(LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpString)
  57. {
  58. return _call(API_WRITESTRING, (HRESULT)E_NOTIMPL, lpSectionName, lpKeyName, lpString);
  59. }
  60. inline HRESULT ifc_omconfig::WriteInt(LPCWSTR lpSectionName, LPCWSTR lpKeyName, INT nValue)
  61. {
  62. return _call(API_WRITEINT, (HRESULT)E_NOTIMPL, lpSectionName, lpKeyName, nValue);
  63. }
  64. inline HRESULT ifc_omconfig::WriteBool(LPCWSTR lpSectionName, LPCWSTR lpKeyName, BOOL bValue)
  65. {
  66. return _call(API_WRITEBOOL, (HRESULT)E_NOTIMPL, lpSectionName, lpKeyName, bValue);
  67. }
  68. inline HRESULT ifc_omconfig::RegisterCallback(ifc_omconfigcallback *callback, unsigned int *cookie)
  69. {
  70. return _call(API_REGISTERCALLBACK, (HRESULT)API_REGISTERCALLBACK, callback, cookie);
  71. }
  72. inline HRESULT ifc_omconfig::UnregisterCallback(unsigned int cookie)
  73. {
  74. return _call(API_UNREGISTERCALLBACK, (HRESULT)E_NOTIMPL, cookie);
  75. }
  76. #endif // NULLSOFT_WINAMP_OMBROWSER_CONFIG_INI_INTERFACE_HEADER