home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / vjplusb / activex / inetsdk / samples / msconf / ezconf / ezconf.c next >
Encoding:
C/C++ Source or Header  |  1996-07-03  |  2.9 KB  |  115 lines

  1. /* ----------------------------------------------------------------------
  2.  
  3.  
  4.     EZCONF sample for Microsoft ActiveX Conferencing
  5.  
  6.     Unplublished work.
  7.     Copyright (c) 1996, Microsoft Corporation
  8.     All rights reserved.
  9.  
  10.     ezconf.c
  11.  
  12.   ---------------------------------------------------------------------- */
  13.  
  14. #define _OLE2_H_
  15.  
  16. // System Include files
  17. #include <windows.h>
  18. #include <msconf.h>
  19.  
  20. #define ClearStruct(lpv)        ZeroMemory((LPVOID) (lpv), sizeof(*(lpv)))
  21. #define InitStruct(lpv)        {ClearStruct(lpv); (* (LPDWORD) lpv) = sizeof(*(lpv));}
  22.  
  23.  
  24. /*  D L L  M A I N */
  25. /*-------------------------------------------------------------------------
  26.     %%Function: DllMain
  27.  
  28.     Avoid loading the default DllMain.
  29. -------------------------------------------------------------------------*/
  30. BOOL WINAPI DllMain(HANDLE hInst, ULONG ulReason, LPVOID lpvReserved)
  31. {
  32.     return TRUE;
  33. }
  34.  
  35.  
  36. /*  C O N F  C O N N E C T */
  37. /*----------------------------------------------------------------------------
  38.     %%Function: ConfConnect
  39.  
  40.     Accepts a machine name as a parameter & fills in the structure
  41.     before making the API call.
  42. ----------------------------------------------------------------------------*/
  43. DWORD WINAPI ConfConnect(LPCTSTR szUser)
  44. {
  45.     HCONF    hConf;
  46.     CONFINFO confInfo;
  47.     CONFADDR confAddr;
  48.  
  49.     InitStruct(&confInfo);
  50.     if (CONFERR_SUCCESS == ConferenceGetInfo(NULL, CONF_ENUM_CONF, &confInfo))
  51.     {
  52.         hConf = confInfo.hConf;
  53.     }
  54.     else
  55.     {
  56.         hConf = NULL;
  57.     }
  58.  
  59.     InitStruct(&confAddr);
  60.     if ((NULL == szUser) || ('\0' == szUser[0]))
  61.     {
  62.         confAddr.dwAddrType = CONF_ADDR_UNKNOWN;
  63.     }
  64.     else
  65.     {
  66.         confAddr.dwAddrType = CONF_ADDR_MACHINENAME;
  67.         confAddr.psz = (PTSTR)szUser;
  68.     }
  69.  
  70.     InitStruct(&confInfo);
  71.     confInfo.dwMediaType = CONF_MT_DATA;
  72.  
  73.     return ConferenceConnect(&hConf, &confAddr, &confInfo, NULL);
  74. }
  75.  
  76.  
  77.  
  78. /* C O N F  S E N D  F I L E */
  79. /*-------------------------------------------------------------------------
  80.     %%Function: ConfSendFile
  81.  
  82.     Do ALL the work necessary to send a simple file.
  83. -------------------------------------------------------------------------*/
  84. DWORD WINAPI ConfSendFile(LPCTSTR szFile)
  85. {
  86.     if ((NULL == szFile) || ('\0' == szFile[0]))
  87.         return CONFERR_SUCCESS;  // nothing to do?
  88.  
  89.     if (MAX_PATH <= lstrlen(szFile))
  90.         return CONFERR_INVALID_PARAMETER;
  91.  
  92.     return ConferenceSendFile(NULL, NULL, szFile, CONF_SF_NOWAIT);
  93. }    
  94.  
  95.  
  96.  
  97. /*  F  I N  D A T A  C O N F */
  98. /*----------------------------------------------------------------------------
  99.     %%Function: FInDataConf
  100.  
  101.     Return TRUE if in a data conference
  102. ----------------------------------------------------------------------------*/
  103. BOOL WINAPI FInDataConf(VOID)
  104. {
  105.     DWORD  dwResult;
  106.     CONFINFO confInfo;
  107.  
  108.     ZeroMemory(&confInfo, sizeof(confInfo));
  109.     confInfo.dwSize = sizeof(confInfo);
  110.     dwResult = ConferenceGetInfo(NULL, CONF_GET_CONF, &confInfo);
  111.     if (CONFERR_SUCCESS != dwResult)
  112.         return FALSE;
  113.     return (0 != (confInfo.dwMediaType & CONF_MT_DATA));
  114. }
  115.