home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / ratings.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  3KB  |  83 lines

  1. //*********************************************************************
  2. //*                  Microsoft Windows                               **
  3. //*       Copyright 1996 - 1998 Microsoft Corporation.               **
  4. //*********************************************************************
  5.  
  6. #ifndef _RATINGS_H_
  7. #define _RATINGS_H_
  8.  
  9. #include <winerror.h>
  10. #include <shlwapi.h>
  11.  
  12. STDAPI RatingEnable(HWND hwndParent, LPCSTR pszUsername, BOOL fEnable);
  13. STDAPI RatingCheckUserAccess(LPCSTR pszUsername, LPCSTR pszURL,
  14.                              LPCSTR pszRatingInfo, LPBYTE pData,
  15.                              DWORD cbData, void **ppRatingDetails);
  16. STDAPI RatingAccessDeniedDialog(HWND hDlg, LPCSTR pszUsername, LPCSTR pszContentDescription, void *pRatingDetails);
  17. STDAPI RatingAccessDeniedDialog2(HWND hDlg, LPCSTR pszUsername, void *pRatingDetails);
  18. STDAPI RatingFreeDetails(void *pRatingDetails);
  19. STDAPI RatingObtainCancel(HANDLE hRatingObtainQuery);
  20. STDAPI RatingObtainQuery(LPCTSTR pszTargetUrl, DWORD dwUserData, void (*fCallback)(DWORD dwUserData, HRESULT hr, LPCTSTR pszRating, void *lpvRatingDetails), HANDLE *phRatingObtainQuery);
  21. STDAPI RatingSetupUI(HWND hDlg, LPCSTR pszUsername);
  22. #ifdef _INC_COMMCTRL
  23. STDAPI RatingAddPropertyPage(PROPSHEETHEADER *ppsh);
  24. #endif
  25.  
  26. STDAPI RatingEnabledQuery();
  27. STDAPI RatingInit();
  28. STDAPI_(void) RatingTerm();
  29.  
  30. //Quick & dirty way to check if ratings are installed. We still need to calling
  31. // ratings dll to find out for sure but this allows us to delay load ratings.
  32. _inline BOOL IS_RATINGS_ENABLED()
  33. {
  34.     TCHAR szSup[200];
  35.     DWORD dwType;
  36.     DWORD cbSize = sizeof(szSup);
  37.  
  38.     return (SHGetValue(HKEY_LOCAL_MACHINE,
  39.                        "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Ratings",
  40.                        "Key",
  41.                        &dwType, &szSup, &cbSize) == ERROR_SUCCESS);
  42. }
  43.  
  44. #define S_RATING_ALLOW        S_OK
  45. #define S_RATING_DENY        S_FALSE
  46. #define S_RATING_FOUND        0x00000002
  47. #define E_RATING_NOT_FOUND    0x80000001
  48.  
  49. /************************************************************************
  50.  
  51. IObtainRating interface
  52.  
  53. This interface is used to obtain the rating (PICS label) for a URL.
  54. It is entirely up to the server to determine how to come up with the
  55. label.  The ObtainRating call may be synchronous.
  56.  
  57. GetSortOrder returns a ULONG which is used to sort this rating helper
  58. into the list of installed helpers.  The helpers are sorted in ascending
  59. order, so a lower numbered helper will be called before a higher numbered
  60. one.
  61.  
  62. ************************************************************************/
  63.  
  64. DECLARE_INTERFACE_(IObtainRating, IUnknown)
  65. {
  66.     // *** IUnknown methods ***
  67.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppvObj) PURE;
  68.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  69.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  70.  
  71.     STDMETHOD(ObtainRating) (THIS_ LPCTSTR pszTargetUrl, HANDLE hAbortEvent,
  72.                              IMalloc *pAllocator, LPSTR *ppRatingOut) PURE;
  73.  
  74.     STDMETHOD_(ULONG,GetSortOrder) (THIS) PURE;
  75. };
  76.  
  77. #define RATING_ORDER_REMOTESITE        0x80000000
  78. #define RATING_ORDER_LOCALLIST        0xC0000000
  79.  
  80.  
  81. #endif
  82. // _RATINGS_H_
  83.