Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
mapiipc.cpp File Reference
#include <windows.h>
#include <windowsx.h>
#include <nscpmapi.h>
#include "resource.h"
#include "mapiipc.h"
#include "mapismem.h"
#include "trace.h"
#include <string.h>

Go to the source code of this file.

Functions

void ProcessCommand (HWND hWnd, int id, HWND hCtl, UINT codeNotify)
BOOL CALLBACK LOADDS MyDlgProc (HWND hWndMain, UINT wMsg, WPARAM wParam, LPARAM lParam)
BOOL InitInstance (HINSTANCE hInstance)
BOOL InitApp (void)
BOOL InitDLL (void)
DWORD nsMAPI_OpenAPI (void)
void nsMAPI_CloseAPI (void)
LRESULT SendMAPIRequest (HWND hWnd, DWORD mapiRequestID, MAPIIPCType *ipcInfo)

Variables

static LONG instanceCount = 0
HWND hWndMAPI = NULL
char szClassName [] = "NetscapeMAPIClient"
char szWindowName [] = "NetscapeMAPI"
HINSTANCE hInstance

Function Documentation

BOOL InitApp ( void  )

Definition at line 145 of file mapiipc.cpp.

{
#ifdef WIN32
  WNDCLASS wc;
  wc.style         = 0; 
  wc.lpfnWndProc   = DefDlgProc; 
  wc.cbClsExtra    = 0; 
  wc.cbWndExtra    = DLGWINDOWEXTRA; 
  wc.hInstance     = hInstance; 
  wc.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(ID_ICON_APP)); 
  wc.hCursor       = LoadCursor(0, IDC_ARROW); 
  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
  wc.lpszMenuName  = NULL; 
  wc.lpszClassName = szClassName;
  
  if(!RegisterClass(&wc))
    return FALSE;
#endif
  
  return TRUE;
} // end InitApp

Here is the caller graph for this function:

BOOL InitDLL ( void  )

Definition at line 168 of file mapiipc.cpp.

{
  if (hWndMAPI != NULL)
    return TRUE;

  if (!InitApp()) 
  { 
    return FALSE;
  }
  
  if (!InitInstance(hInstance)) 
  {    
    return FALSE;
  }
  
//  ShowWindow(hWndMAPI, SW_SHOW);    Just for jollies
  return(TRUE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL InitInstance ( HINSTANCE  hInstance)

Definition at line 115 of file mapiipc.cpp.

{
  //
  // Create a main window for this application instance.  
  //
  /* RICHIE - TRY SOME CHANGES!!!
  hWndMAPI = CreateDialog((HINSTANCE) hInstance, 
        MAKEINTRESOURCE(ID_DIALOG_QAHOOK),
        (HWND) NULL, (DLGPROC) MyDlgProc);
   ******/
  hWndMAPI = CreateWindow(
              szClassName,  // pointer to registered class name
              szWindowName, // pointer to window name
              WS_CHILD,         // window style
              -10,                 // horizontal position of window
              -10,             // vertical position of window
              1,               // window width
              1,               // window height
              GetDesktopWindow(),  // handle to parent or owner window
              NULL,          // handle to menu or child-window identifier
              hInstance,      // handle to application instance
              NULL          // pointer to window-creation data
              );
  if (!hWndMAPI)
    return FALSE;
  else
    return TRUE;
}

Here is the caller graph for this function:

BOOL CALLBACK LOADDS MyDlgProc ( HWND  hWndMain,
UINT  wMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 85 of file mapiipc.cpp.

{
  switch (wMsg) 
  {
  case WM_INITDIALOG: 
    {
      hWndMAPI = hWndMain;
    }
    break;
    
  case WM_CLOSE:
//    DestroyWindow(hWndMain);
    break;
    
  case WM_DESTROY:
    hWndMain = NULL;
    break;

  case WM_COMMAND:
         HANDLE_WM_COMMAND(hWndMAPI, wParam, lParam, ProcessCommand);
    break;

  default:
    return FALSE;
  }

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 209 of file mapiipc.cpp.

{
  --instanceCount;
  if (instanceCount <= 0)
  {
    instanceCount = 0;
  }

  return;
}

Here is the caller graph for this function:

Definition at line 195 of file mapiipc.cpp.

{
  if (instanceCount > 0)
  {
    return(1);
  }

  ++instanceCount;
  return(1);
}

Here is the caller graph for this function:

void ProcessCommand ( HWND  hWnd,
int  id,
HWND  hCtl,
UINT  codeNotify 
)

Definition at line 69 of file mapiipc.cpp.

{ 
       switch (id) 
       {
       case IDOK:   
       case IDCANCEL:
              {
                     ShowWindow(hWnd, SW_HIDE);
              }
              
       default:
              ;
       }
}

Here is the caller graph for this function:

LRESULT SendMAPIRequest ( HWND  hWnd,
DWORD  mapiRequestID,
MAPIIPCType ipcInfo 
)

Definition at line 224 of file mapiipc.cpp.

{
LRESULT         returnVal = 0;
COPYDATASTRUCT  cds;

  if (!InitDLL())
  {
    return 0;
  }

  cds.dwData = mapiRequestID;
  cds.cbData = sizeof(MAPIIPCType);
  cds.lpData = ipcInfo;

  // Make the call into Communicator
  returnVal = SendMessage(hWnd, WM_COPYDATA, (WPARAM) hWndMAPI, (LPARAM) &cds);

  // Now kill the window...
  DestroyWindow(hWndMAPI);
  hWndMAPI = NULL;
  UnregisterClass(szClassName, hInstance);
  
  return returnVal;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 46 of file maindll.cpp.

Definition at line 59 of file mapiipc.cpp.

LONG instanceCount = 0 [static]

Definition at line 58 of file mapiipc.cpp.

char szClassName[] = "NetscapeMAPIClient"

Definition at line 60 of file mapiipc.cpp.

char szWindowName[] = "NetscapeMAPI"

Definition at line 61 of file mapiipc.cpp.