Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
readmail.cpp File Reference
#include <windows.h>
#include <windowsx.h>
#include <mapi.h>
#include "port.h"
#include "resource.h"

Go to the source code of this file.

Functions

void ShowMessage (HWND hWnd, LPSTR msg)
void SetFooter (LPSTR msg)
LPSTR GetMAPIError (LONG errorCode)
void ProcessReadMailCommand (HWND hWnd, int id, HWND hCtl, UINT codeNotify)
BOOL CALLBACK LOADDS ReadMailDlgProc (HWND hWndMail, UINT wMsg, WPARAM wParam, LPARAM lParam)
void DisplayMAPIReadMail (HWND hWnd, lpMapiMessage msgPtr)

Variables

HINSTANCE hInst
HINSTANCE m_hInstMapi
LHANDLE mapiSession
lpMapiMessage mailPtr = NULL

Function Documentation

void DisplayMAPIReadMail ( HWND  hWnd,
lpMapiMessage  msgPtr 
)

Definition at line 132 of file readmail.cpp.

{
  mailPtr = msgPtr;
  DialogBox(hInst, MAKEINTRESOURCE(ID_DIALOG_READMAIL), hWnd, 
                (DLGPROC)ReadMailDlgProc);
}

Here is the call graph for this function:

Here is the caller graph for this function:

LPSTR GetMAPIError ( LONG  errorCode)

Definition at line 86 of file mapiproc.cpp.

{
  static char FAR msg[128];

  switch (errorCode) {                            
  case MAPI_E_FAILURE:
    lstrcpy(msg, "General MAPI Failure");
    break;

  case MAPI_E_INSUFFICIENT_MEMORY:
    strcpy(msg, "Insufficient Memory");
    break;

  case MAPI_E_LOGIN_FAILURE:
    strcpy(msg, "Login Failure");
    break;

  case MAPI_E_TOO_MANY_SESSIONS:
    strcpy(msg, "Too many MAPI sessions");
    break;

  case MAPI_E_INVALID_SESSION:
    strcpy(msg, "Invalid Session!");
    break;

  case MAPI_E_INVALID_MESSAGE:
    strcpy(msg, "Message identifier was bad!");
    break;

  case MAPI_E_NO_MESSAGES:
    strcpy(msg, "No messages were found!");
    break;

  case MAPI_E_ATTACHMENT_WRITE_FAILURE:
    strcpy(msg, "Attachment write failure!");
    break;

  case MAPI_E_DISK_FULL:
    strcpy(msg, "Attachment write failure! DISK FULL");
    break;

  case MAPI_E_AMBIGUOUS_RECIPIENT:
    strcpy(msg, "Recipient requested is not a unique address list entry.");
    break;

  case MAPI_E_UNKNOWN_RECIPIENT:
    strcpy(msg, "Recipient requested does not exist.");
    break;

  case MAPI_E_NOT_SUPPORTED:
    strcpy(msg, "Not supported by messaging system");
    break;

  case SUCCESS_SUCCESS:
    strcpy(msg, "Success on MAPI operation");
    break;

  case MAPI_E_INVALID_RECIPS:
    strcpy(msg, "Recipient specified in the lpRecip parameter was\nunknown. No dialog box was displayed.");
    break;

  case MAPI_E_ATTACHMENT_OPEN_FAILURE:
    strcpy(msg, "One or more files could not be located. No message was sent.");    
    break;

  case MAPI_E_ATTACHMENT_NOT_FOUND:
    strcpy(msg, "The specified attachment was not found. No message was sent.");
    break;

  case MAPI_E_BAD_RECIPTYPE:
    strcpy(msg, "The type of a recipient was not MAPI_TO, MAPI_CC, or MAPI_BCC. No message was sent.");
    break;

  default:
    strcpy(msg, "Unknown MAPI Return Code");
    break;
  }

  return((LPSTR) &(msg[0]));
}
void ProcessReadMailCommand ( HWND  hWnd,
int  id,
HWND  hCtl,
UINT  codeNotify 
)

Definition at line 64 of file readmail.cpp.

{ 
  switch (id) 
  {
  case ID_OK:
  case IDCANCEL:
    EndDialog(hWnd, 0);
    break;

  default:
    break;
  }
}

Here is the caller graph for this function:

BOOL CALLBACK LOADDS ReadMailDlgProc ( HWND  hWndMail,
UINT  wMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 79 of file readmail.cpp.

{
  switch (wMsg) 
  {
  case WM_INITDIALOG: 
    {
      DWORD i;
      // Do everything we need to display the message pointed to by
      // mailPtr
      if (!mailPtr)
        break;

      // Start with the basics...
      SetDlgItemText(hWndMail, IDC_EDIT_SUBJECT, mailPtr->lpszSubject);
      SetDlgItemText(hWndMail, IDC_EDIT_DATETIME, mailPtr->lpszDateReceived);
      SetDlgItemText(hWndMail, IDC_EDIT_THREAD, mailPtr->lpszConversationID);
      SetDlgItemText(hWndMail, IDC_EDIT_BODYTEXT, mailPtr->lpszNoteText);

      char    buf[1024];
      wsprintf(buf, "%s (%s)", mailPtr->lpOriginator->lpszName, 
                              mailPtr->lpOriginator->lpszAddress);
      SetDlgItemText(hWndMail, IDC_EDIT_FROM, buf);

      for (i=0; i<mailPtr->nRecipCount; i++)
      {
          wsprintf(buf, "%s (%s)", mailPtr->lpRecips[i].lpszName, 
                                   mailPtr->lpRecips[i].lpszAddress);
          ListBox_InsertString(GetDlgItem(hWndMail, IDC_LIST_RECIPIENTS), 
                  ListBox_GetCount(GetDlgItem(hWndMail, IDC_LIST_RECIPIENTS)), 
                  buf);
      }

      for (i=0; i<mailPtr->nFileCount; i++)
      {
          ListBox_InsertString(GetDlgItem(hWndMail, IDC_LIST_ATTACHMENTS), 
                ListBox_GetCount(GetDlgItem(hWndMail, IDC_LIST_ATTACHMENTS)), 
                mailPtr->lpFiles[i].lpszPathName);
      }
    }
    break;

  case WM_COMMAND:
    HANDLE_WM_COMMAND(hWndMail, wParam, lParam, ProcessReadMailCommand);
    break;

  default:
    return FALSE;
  }
  
  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SetFooter ( LPSTR  msg)

Definition at line 78 of file mapiproc.cpp.

{
  extern HWND   hWnd;

  SetDlgItemText(hWnd, ID_STATIC_RESULT, msg);
}
void ShowMessage ( HWND  hWnd,
LPSTR  msg 
)

Definition at line 168 of file mapiproc.cpp.

{
  MessageBox(hWnd, msg, "Info Message", MB_ICONINFORMATION);
}

Variable Documentation

Definition at line 65 of file main.cpp.

Definition at line 53 of file mapiproc.cpp.

lpMapiMessage mailPtr = NULL

Definition at line 61 of file readmail.cpp.

LHANDLE mapiSession

Definition at line 54 of file mapiproc.cpp.