home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / ddecmd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.3 KB  |  119 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. //by Abe Jarrett
  20. //Purpose:  Hard Wired DDE conversation for command line processing.
  21. //            Used to launch specific components the app.
  22. //NOTE:        Most if not all of the code and frame work herein was taken
  23. //            from dde.cpp.  Thanks to GAB for his assistance!
  24.  
  25.  
  26.  
  27. #ifndef __DDECMD_H
  28. #define __DDECMD_H
  29.  
  30. //    Required Includes
  31. //
  32. #ifndef __DDE_H
  33.  
  34. #ifndef WIN32
  35. #include "ddeml2.h"
  36. #else
  37. #include <ddeml.h>
  38. #endif // WIN32
  39.  
  40. #endif //just in case they take out the other dde includes
  41.  
  42. //    Constants
  43. //
  44. //    Change this on each revision.  Hiword is major, Loword is minor.
  45. const DWORD gdwDDEVersion = 0x00010001UL;
  46.  
  47. //  Careful, 32bit bools will byte you.
  48.  
  49.  
  50. //    Structures
  51. //
  52. class CDDECMDWrapper    {
  53.     //    Enumeration values which index into our static HSZ array.
  54.     //    Faster than list lookups.
  55.     
  56.  
  57. public:
  58.  
  59.     CDDECMDWrapper(HSZ hszService, HSZ hszTopic, HCONV hConv);
  60.  
  61.     ~CDDECMDWrapper();
  62.  
  63.     enum
  64.     {
  65.         m_MinHSZ = 0,
  66.         m_ServiceName = 0,
  67.         m_TopicStart = 1,    //    Where topics begin, services end
  68.         m_OpenURL = 1,
  69.         m_ProcessCmdLine,
  70.         m_MaxHSZ,    //    Where all hsz strings end, and where topics end
  71.         m_Timeout = 30000,    //    Timeout value, in milliseconds, that the we will wait as a client.
  72.     };
  73.     
  74.     static DWORD m_dwidInst;    //    Our DDEML instance.  Only 1 ever.
  75.     static BOOL m_bDDEActive;    //    Wether or not DDEML was initialized.
  76.     static HSZ m_hsz[m_MaxHSZ];    //    Array of HSZs to be used by all
  77.     static CMapPtrToPtr m_ConvList;    //    Map of current conversations
  78.     static DWORD m_dwafCmd;    //    array of command and filter flags
  79.     static FARPROC m_pfnCallBack;    //    Call back function after MakeProcIntance
  80.     
  81.     
  82.     //    Conversation instance specific members
  83.     HSZ m_hszService;    //    The service this object represent
  84.     int m_iService;    //    The enumerated service number; useful.
  85.     HSZ m_hszTopic;    //    The topic this object represents.
  86.     int m_iTopic;    //    The enumerated topic number; very useful.
  87.     HCONV m_hConv;    //    The conversation this object represents.
  88.     CString m_csProgressApp;    //    The service that we will update.
  89.  
  90.     //General members for informational lookup
  91.     static CDDECMDWrapper *GetConvObj(HCONV hConv);
  92.     static int EnumTopic(HSZ& hsz);
  93.  
  94.     //    Client connection establisher.
  95.     static CDDECMDWrapper *ClientConnect(const char *cpService,
  96.         HSZ& hszTopic);
  97. };
  98.  
  99. //    Global variables
  100. //
  101.  
  102. //    Macros
  103. //
  104.  
  105. //    Function declarations
  106. //
  107. void DDEInitCmdLineConversation();
  108. void DDEShutdown();
  109. HDDEDATA 
  110. CALLBACK 
  111. #ifndef XP_WIN32
  112. _export 
  113. #endif
  114. CmdLineDdeCallBack(UINT type, UINT fmt,
  115.     HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1,
  116.     DWORD dwData2);
  117.  
  118. #endif //__DDECMD_H
  119.