home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / fedde.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  7.0 KB  |  207 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. #ifndef __DDE_H
  20. //    Avoid include redundancy.
  21. //
  22. //
  23. #define __DDE_H
  24.  
  25. //    Purpose:    Header file for DDE remote control
  26.  
  27. #ifndef WIN32
  28. #include "ddeml2.h"
  29. #else
  30. #include <ddeml.h>
  31. #endif // WIN32
  32.  
  33. //    Constants
  34. //
  35. //    Change this on each revision.  Hiword is major, Loword is minor.
  36. const DWORD dwDDEVersion = 0x00030000UL;
  37.  
  38. //  Careful, 32bit bools will byte you.
  39. typedef short TwoByteBool;
  40.  
  41. //    Structures
  42. //
  43. struct CDDEWrapper    {
  44.     //    Enumeration values which index into our static HSZ array.
  45.     //    Faster than list lookups.
  46.     enum    {
  47.         m_MinHSZ = 0,
  48.         m_ServiceName = 0,
  49.         m_TopicStart = 1,    //    Where topics begin, services end
  50.         m_OpenURL = 1,
  51.         m_ShowFile,
  52.         m_Activate,
  53.         m_ListWindows,
  54.         m_GetWindowInfo,
  55.         m_ParseAnchor,
  56.         m_Exit,
  57.         m_RegisterProtocol,
  58.         m_UnRegisterProtocol,
  59.         m_RegisterViewer,
  60.         m_QueryViewer,
  61.         m_ViewDocFile,
  62.         m_UnRegisterViewer,
  63.         m_RegisterURLEcho,
  64.         m_URLEcho,
  65.         m_UnRegisterURLEcho,
  66.         m_RegisterWindowChange,
  67.         m_WindowChange,
  68.         m_UnRegisterWindowChange,
  69.         m_BeginProgress,
  70.         m_SetProgressRange,
  71.         m_MakingProgress,
  72.         m_EndProgress,
  73.         m_Alert,
  74.         m_ListOptions,
  75.         m_GetOption,
  76.         m_SetOption,
  77.         m_Version,
  78.         m_CancelProgress,
  79.         m_QueryURLFile,
  80.         m_InternetShortcut,
  81.         m_MaxHSZ,    //    Where all hsz strings end, and where topics end
  82.         m_Timeout = 2000,    //    Timeout value, in milliseconds, that the we will wait as a client.
  83.         m_AlertError = 0,    //    Possible alert box types
  84.         m_AlertWarning = 1,
  85.         m_AlertQuestion = 2,
  86.         m_AlertStatus = 3,
  87.         m_ButtonOk = 0,        //    Possible buttons to show in alert box
  88.         m_ButtonOkCancel = 1,
  89.         m_ButtonYesNo = 2,
  90.         m_ButtonYesNoCancel = 3,
  91.         m_PushedError = 0,
  92.         m_PushedOk = 1,        //    The button pushed in an alert box.
  93.         m_PushedCancel = 2,
  94.         m_PushedNo = 3,
  95.         m_PushedYes = 4
  96.     };
  97.     
  98.     static DWORD m_dwidInst;    //    Our DDEML instance.  Only 1 ever.
  99.     static BOOL m_bDDEActive;    //    Whether or not DDEML was initialized.
  100.     static HSZ m_hsz[m_MaxHSZ];    //    Array of HSZs to be used by all
  101.     static CMapPtrToPtr m_ConvList;    //    Map of current conversations
  102.     static DWORD m_dwafCmd;    //    array of command and filter flags
  103.     static FARPROC m_pfnCallBack;    //    Call back function after MakeProcIntance
  104.     static UINT m_cfFmts[];    //    array of acceptable clipboard formats
  105.     
  106.     CDDEWrapper(HSZ hszService, HSZ hszTopic, HCONV hConv);
  107.     ~CDDEWrapper();
  108.     
  109.     //    Conversation instance specific members
  110.     HSZ m_hszService;    //    The service this object represents.
  111.     int m_iService;    //    The enumerated service number; useful.
  112.     HSZ m_hszTopic;    //    The topic this object represents.
  113.     int m_iTopic;    //    The enumerated topic number; very useful.
  114.     HCONV m_hConv;    //    The conversation this object represents.
  115.     CString m_csProgressApp;    //    The service that we will update.
  116.  
  117.     //    General members for informational lookup
  118.     static CDDEWrapper *GetConvObj(HCONV hConv);
  119.     static int EnumTopic(HSZ& hsz);
  120.     static void ScanArgs(HSZ& hszArgs, const char *pFormat, ...);
  121.     static void ScanDataArgs(HDDEDATA& hArgs, const char *pFormat, ...);
  122.     static HDDEDATA MakeArgs(const char *pFormat, ...);
  123.     static HSZ MakeItemArgs(const char *pFormat, ...);
  124.     static char *SkipToNextFormat(char *pCurrent);
  125.     static char *ExtractArg(HSZ& hszArgs, int iArgNum);
  126.     
  127.     //    DDE Callback handlers for a conversation
  128.     HDDEDATA PokeHandler(HSZ& hszTopic, HSZ& hszItem, HDDEDATA& hData);
  129.     HDDEDATA RequestHandler(HSZ& hszTopic, HSZ& hszItem);
  130.     
  131.     //    Server Requests
  132.     HDDEDATA OpenURL(HSZ& hszItem);
  133.     HDDEDATA ShowFile(HSZ& hszItem);
  134.     HDDEDATA Activate(HSZ& hszItem);
  135.     HDDEDATA ListWindows(HSZ& hszItem);
  136.     HDDEDATA GetWindowInfo(HSZ& hszItem);
  137.     HDDEDATA ParseAnchor(HSZ& hszItem);
  138.     HDDEDATA RegisterProtocol(HSZ& hszItem);
  139.     HDDEDATA UnRegisterProtocol(HSZ& hszItem);
  140.     HDDEDATA RegisterViewer(HSZ& hszItem);
  141.     HDDEDATA UnRegisterViewer(HSZ& hszItem);
  142.     HDDEDATA RegisterWindowChange(HSZ& hszItem);
  143.     HDDEDATA UnRegisterWindowChange(HSZ& hszItem);
  144.     HDDEDATA BeginProgress(HSZ& hszItem)    { return(NULL); }
  145.     HDDEDATA MakingProgress(HSZ& hszItem)    { return(NULL); }
  146.     HDDEDATA EndProgress(HSZ& hszItem)    { return(NULL); }
  147.     HDDEDATA ListOptions(HSZ& hszItem);
  148.     HDDEDATA GetOption(HSZ& hszItem);
  149.     HDDEDATA Version(HSZ& hszItem);
  150.     HDDEDATA QueryURLFile(HSZ& hszItem);
  151.     
  152.     //    Server Pokes
  153.     HDDEDATA Exit(HSZ& hszItem, HDDEDATA& hData);
  154.     HDDEDATA SetProgressRange(HSZ& hszItem, HDDEDATA& hData)    { return(NULL); }
  155.     HDDEDATA SetOption(HSZ& hszItem, HDDEDATA& hData);
  156.     HDDEDATA RegisterURLEcho(HSZ& hszItem, HDDEDATA& hData);
  157.     HDDEDATA UnRegisterURLEcho(HSZ& hszItem, HDDEDATA& hData);
  158.     HDDEDATA WindowChange(HSZ& hszItem, HDDEDATA& hData);
  159.     HDDEDATA CancelProgress(HSZ& hszItem, HDDEDATA& hData);
  160.     
  161.     //    Client connection establisher.
  162.     static CDDEWrapper *ClientConnect(const char *cpService,
  163.         HSZ& hszTopic);
  164.     
  165.     //    Client Progress
  166.     static DWORD BeginProgress(CNetscapeDoc *pDoc, const char *pService,
  167.         DWORD dwWindowID, const char *pMessage);
  168.     static void SetProgressRange(CNetscapeDoc *pDoc, const char *pService,
  169.         DWORD dwTransactionID, DWORD dwMaxRange);
  170.     static TwoByteBool MakingProgress(CNetscapeDoc *pDoc, const char *pService,
  171.         DWORD dwTransactionID, const char *pMessage, DWORD dwCurrent);
  172.     static void EndProgress(CNetscapeDoc *pDoc, const char *pService,
  173.         DWORD dwTransactionID);
  174.     static DWORD AlertProgress(CNetscapeDoc *pDoc, const char *pService,
  175.         const char *pMessage);
  176.         
  177.     //    Client Viewer Commands
  178.     static void QueryViewer(CDDEDownloadData *pDData);
  179.     static void ViewDocFile(CDDEDownloadData *pDData);
  180.     static void OpenDocument(CDDEDownloadData *pDData);
  181.     
  182.     //    Client Protocol Commands.
  183.     static TwoByteBool OpenURL(CString csProtocol, CString csServiceName, URL_Struct *pURL, MWContext *pContext, FO_Present_Types iFormatOut);
  184.     
  185.     //    Client Echo commands.
  186.     static void URLEcho(CDDEEchoItem *pItem, CString& csURL, CString& csMimeType, DWORD dwWindowID, CString& csReferrer);
  187.     
  188.     //    Client Window change commands.
  189.     static void WindowChange(CDDEWindowChangeItem *pItem, int iChange, TwoByteBool bExiting = FALSE, DWORD dwX = 0, DWORD dwY = 0,
  190.         DWORD dwCX = 0, DWORD cwCY = 0);
  191. };
  192.  
  193. //    Function declarations
  194. //
  195. void DDEStartup();
  196. void DDEShutdown();
  197. HDDEDATA 
  198. CALLBACK 
  199. #ifndef XP_WIN32 
  200. _export 
  201. #endif // no _export in windows 32
  202. NetscapeDDECallBack(UINT type, UINT fmt,
  203.     HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hData, DWORD dwData1,
  204.     DWORD dwData2);
  205.  
  206. #endif // __DDE_H
  207.