home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 November / APC411-2.ISO / server / ohttp203.exe / data1.cab / Program_Executable_Files / flush.cpp next >
Encoding:
C/C++ Source or Header  |  1999-07-15  |  1.2 KB  |  40 lines

  1. //    OmniHTTPd Professional Server Flush Utility
  2. //
  3. //    OmniHTTPd Professional, starting with version 2.03, will wait on
  4. //    a system event object to flush its configuration.  This facilitates
  5. //    the development of remote admin scripts and other types of security
  6. //    functions.
  7. //
  8. //    We recommend pasting this code into your own scripts instead of
  9. //    calling this program.
  10. //
  11.  
  12. #include <windows.h>
  13.  
  14. #define    SERVERFLUSH_EVENT    "OmniHTTPdServerFlushEvent"
  15.  
  16. //    FlushOmniHTTPdConfiguration
  17. //    Triggers the event to flush the configuration of the server
  18. //    Return value:
  19. //    If the event was triggered successfully, the functions returns 0 (ERROR_SUCCESS)
  20. //    If the server event could not be found, the function returns 2 (ERROR_FILE_NOT_FOUND)
  21. //    Other error codes may be returned as well.  See OpenEvent() for details.
  22. //
  23. //    Note:
  24. //    The success of the event trigger does not gaurantee that the server flushed itself.
  25. //
  26. int FlushOmniHTTPdConfiguration()
  27. {
  28.     HANDLE    flushEvent;
  29.     flushEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, SERVERFLUSH_EVENT);
  30.     if (!flushEvent) return GetLastError();
  31.     SetEvent(flushEvent);
  32.     CloseHandle(flushEvent);
  33.     return ERROR_SUCCESS;
  34. }
  35.  
  36. int main()
  37. {
  38.     return FlushOmniHTTPdConfiguration();
  39. }
  40.