Beispiel #1
0
BOOL CTabCtrlSSL::ActivateSSLPage (int nIndex) {
	if (nIndex >= GetItemCount ())
		return FALSE;

	// Do nothing if the specified page is already active.
	if (nIndex == GetCurSel ())
		return TRUE;

	// Deactivate the current page.
	int nOldIndex = GetCurSel ();

	if (nIndex != -1) {
        TabDelete tabDelete = m_tabs[nOldIndex];
        CTabPageSSL* pDialog = tabDelete.pTabPage;
		if (pDialog != NULL) {
			m_hFocusWnd[nOldIndex] = ::GetFocus ();
			pDialog->ShowWindow (SW_HIDE);
		}
	}

	// Activate the new one.
	SetCurSel (nIndex);
    TabDelete tabDelete = m_tabs[nIndex];
    CTabPageSSL* pDialog = tabDelete.pTabPage;

	if (pDialog != NULL) {
		::SetFocus (m_hFocusWnd[nIndex]);
		CRect rect;
		GetClientRect (&rect);
		ResizeDialog (nIndex, rect.Width (), rect.Height ());
		pDialog->ShowWindow (SW_SHOW);
	}
	return TRUE;
}
void CExtractDlg::DisplayGroup(int groupId)
{
	ResizeDialog(true);

	m_currentGroup = groupId;
	bool molCountGroup = (groupId == 1);

	SetDlgItemText(IDC_EXTRAOPTIONS, molCountGroup
		? _T("Extract Count Options")
		: _T("File Format Options"));

	::ShowWindow(GetDlgItem(IDC_RDO_EXTRACTALL), molCountGroup ? SW_SHOW : SW_HIDE);
	::ShowWindow(GetDlgItem(IDC_RDO_EXTRACTSOME), molCountGroup ? SW_SHOW : SW_HIDE);
	::ShowWindow(GetDlgItem(IDC_EDTEXTRACTCOUNT), molCountGroup ? SW_SHOW : SW_HIDE);
	::ShowWindow(GetDlgItem(IDC_STATIC_EXTRACTMOL), molCountGroup ? SW_SHOW : SW_HIDE);
	::ShowWindow(GetDlgItem(IDC_LBL_FILEFORMAT), !molCountGroup ? SW_SHOW : SW_HIDE);
	::ShowWindow(GetDlgItem(IDC_EDT_FILEFORMAT), !molCountGroup ? SW_SHOW : SW_HIDE);

	// set focus to the textboxes
	if(molCountGroup)
	{
		if(IsDlgButtonChecked(IDC_RDO_EXTRACTSOME) == BST_CHECKED)
		{
			::SetFocus(GetDlgItem(IDC_EDTEXTRACTCOUNT));
		}
	}
	else
	{
		::SetFocus(GetDlgItem(IDC_EDT_FILEFORMAT));
	}
}
Beispiel #3
0
int CTabCtrlSSL::AddPage (LPCTSTR pszTitle, int nPageID, TabDelete tabDelete) {
	// Add a page to the tab control.
	TC_ITEM item;
	item.mask = TCIF_TEXT;
	item.pszText = (LPTSTR) pszTitle;
	int nIndex = GetItemCount ();
	
	if (InsertItem (nIndex, &item) == -1)
		return -1;

    if (NULL == tabDelete.pTabPage) {
		// Fail - no point calling the function with a NULL pointer!
		DeleteItem (nIndex);
		return -1;
	}
	else {
		// Record the address of the dialog object and the page ID.
		int nArrayIndex = m_tabs.Add (tabDelete);
		ASSERT (nIndex == nArrayIndex);

		nArrayIndex = m_nPageIDs.Add (nPageID);
		ASSERT (nIndex == nArrayIndex);

		// Size and position the dialog box within the view.
        tabDelete.pTabPage->SetParent (this); // Just to be sure

		CRect rect;
		GetClientRect (&rect);

		if (rect.Width () > 0 && rect.Height () > 0)
			ResizeDialog (nIndex, rect.Width (), rect.Height ());

		// Initialize the page.
		if (OnInitPage (nIndex, nPageID)) {
			// Make sure the first control in the dialog is the one that
			// receives the input focus when the page is displayed.
			if (tabDelete.pTabPage->GetTopWindow ()) {
				HWND hwndFocus = tabDelete.pTabPage->GetTopWindow ()->m_hWnd;
				nArrayIndex = m_hFocusWnd.Add (hwndFocus);
				ASSERT (nIndex == nArrayIndex);
			}
		}
		else {
			// Make the control that currently has the input focus is the one
			// that receives the input focus when the page is displayed.
			m_hFocusWnd.Add (::GetFocus ());
		}

		// If this is the first page added to the view, make it visible.
		if (nIndex == 0)
			tabDelete.pTabPage->ShowWindow (SW_SHOW);
	}
	return nIndex;
}
Beispiel #4
0
BOOL CALLBACK ChessDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
   HWND hwnd;
   RECT rect;

   UserDidSomething();
   switch (message)
   {
   case WM_INITDIALOG:
      CenterWindow(hDlg, c->hMain);
      hChessDlg = hDlg;

      hwnd = GetDlgItem(hDlg, IDC_BOARD);
      lpfnDefBoardProc = SubclassWindow(hwnd, ChessBoardProc);

      /* Store dialog rectangle in case of resize */
      GetWindowRect(hDlg, &dlg_rect);
      min_window_size.cx = dlg_rect.right - dlg_rect.left;
      min_window_size.cy = dlg_rect.bottom - dlg_rect.top;
      if (min_window_size.cy == 0)
	 aspect_ratio = 1.0;
      else aspect_ratio = min_window_size.cx / min_window_size.cy;

      GetClientRect(hwnd, &rect);
      b.square_size = min(rect.bottom / BOARD_HEIGHT, rect.right / BOARD_WIDTH);

      b.valid = False;
      return TRUE;

   case WM_SIZE:
      ResizeDialog(hDlg, &dlg_rect, chess_controls);
      hwnd = GetDlgItem(hDlg, IDC_BOARD);
      GetClientRect(hwnd, &rect);
      b.square_size = min(rect.bottom / BOARD_HEIGHT, rect.right / BOARD_WIDTH);
      return TRUE;
      
      HANDLE_MSG(hDlg, WM_COMMAND, ChessDlgCommand);
      HANDLE_MSG(hDlg, WM_GETMINMAXINFO, ChessMinMaxInfo);
      
      HANDLE_MSG(hDlg, WM_INITMENUPOPUP, InitMenuPopupHandler);

   case WM_ACTIVATE:
      if (wParam == 0)
	 *c->hCurrentDlg = NULL;
      else *c->hCurrentDlg = hDlg;
      return TRUE;

   case WM_DESTROY:
      hChessDlg = NULL;
      return TRUE;
   }
   return FALSE;
}
Beispiel #5
0
void CTabCtrlSSL::OnSelChange (NMHDR* pNMHDR, LRESULT* pResult) {
	int nIndex = GetCurSel ();
	if (nIndex == -1)
		return;

	// Show the new page.
    TabDelete tabDelete = m_tabs[nIndex];
    CTabPageSSL* pDialog = tabDelete.pTabPage;

	if (pDialog != NULL) {
		::SetFocus (m_hFocusWnd[nIndex]);
		CRect rect;
		GetClientRect (&rect);
		ResizeDialog (nIndex, rect.Width (), rect.Height ());
		pDialog->ShowWindow (SW_SHOW);
	}

	// Notify derived classes that the selection has changed.
	OnActivatePage (nIndex, m_nPageIDs[nIndex]);
	*pResult = 0;
}
Beispiel #6
0
static LONG_PTR WINAPI DlgProc(HANDLE hDlg,int Msg,int Param1,LONG_PTR Param2)
{
  static TCHAR Filter[MAX_PATH];
  static TCHAR spFilter[MAX_PATH];
  static FarListTitles ListTitle;

  switch(Msg)
  {
    case DN_RESIZECONSOLE:
    {
      Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,FALSE,0);
      ResizeDialog(hDlg);
      Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,TRUE,0);
    }
    return TRUE;

    case DMU_UPDATE:
    {
      int OldPos = static_cast<int>(Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,0));

      if (Param1)
        UpDateInfo();

      ListSize = 0;
      int NewPos = -1;
      if (OldPos >= 0 && OldPos < nCount)
      {
        if (!*Filter || strstri(p[OldPos].Keys[DisplayName],Filter)) //без учета регистра в OEM кодировке
          NewPos = OldPos;
      }
      for (int i = 0; i < nCount; i++)
      {
        const TCHAR* DispName = p[i].Keys[DisplayName], *Find;
        if (*Filter)
          Find = strstri(DispName,Filter);
        else
          Find = DispName;
        if (Find != nullptr) //без учета регистра в OEM кодировке
        {
          FLI[i].Flags &= ~LIF_HIDDEN;
          if (Param2 && (i == OldPos))
          {
            if (FLI[i].Flags & LIF_CHECKED)
            {
              FLI[i].Flags &= ~LIF_CHECKED;
            }
            else
            {
              FLI[i].Flags |= LIF_CHECKED;
            }
          }
          //без учета регистра - а кодировка ANSI
          if (NewPos == -1 && Find == DispName)
            NewPos = i;
          ListSize++;
        }
        else
          FLI[i].Flags |= LIF_HIDDEN;
      }
      if (Param1 == 0 && Param2)
      {
        // Снятие или установка пометки (Ins)
        if (Param2 == 1)
        {
          for (int i = (OldPos+1); i < nCount; i++)
          {
            if (!(FLI[i].Flags & LIF_HIDDEN))
            {
              OldPos = i; break;
            }
          }
          NewPos = OldPos;
        }
        // Снятие или установка пометки (RClick)
        else if (Param2 == 2)
        {
          NewPos = OldPos;
        }
      }
      else if (NewPos == -1)
      {
        NewPos = OldPos;
      }

      Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,FALSE,0);

      Info.SendDlgMessage(hDlg,DM_LISTSET,LIST_BOX,reinterpret_cast<LONG_PTR>(&FL));

      StringCchPrintf(spFilter,ARRAYSIZE(spFilter), GetMsg(MFilter),Filter,ListSize,nCount);
      ListTitle.Title = spFilter;
      ListTitle.TitleLen = lstrlen(spFilter);
      Info.SendDlgMessage(hDlg,DM_LISTSETTITLES,LIST_BOX,reinterpret_cast<LONG_PTR>(&ListTitle));

      ResizeDialog(hDlg);

      struct FarListPos FLP;
      FLP.SelectPos = NewPos;
      FLP.TopPos = -1;
      Info.SendDlgMessage(hDlg,DM_LISTSETCURPOS,LIST_BOX,reinterpret_cast<LONG_PTR>(&FLP));

      Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,TRUE,0);
    }
    break;

    case DN_INITDIALOG:
    {
      StringCchCopy(Filter,ARRAYSIZE(Filter),_T(""));
      ListTitle.Bottom = const_cast<TCHAR*>(GetMsg(MBottomLine));
      ListTitle.BottomLen = lstrlen(GetMsg(MBottomLine));

      //подстраиваемся под размеры консоли
      Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,FALSE,0);
      ResizeDialog(hDlg);
      Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,TRUE,0);
      //заполняем диалог
      Info.SendDlgMessage(hDlg,DMU_UPDATE,1,0);
    }
    break;

    case DN_MOUSECLICK:
    {
      if (Param1 == LIST_BOX)
      {
        MOUSE_EVENT_RECORD *mer = (MOUSE_EVENT_RECORD *)Param2;
        if (mer->dwButtonState == FROM_LEFT_1ST_BUTTON_PRESSED)
        {
          // find list on-screen coords (excluding frame and border)
          SMALL_RECT list_rect;
          Info.SendDlgMessage(hDlg, DM_GETDLGRECT, 0, reinterpret_cast<LONG_PTR>(&list_rect));
          list_rect.Left += 2;
          list_rect.Top += 1;
          list_rect.Right -= 2;
          list_rect.Bottom -= 1;
          if ((mer->dwEventFlags == 0) && (mer->dwMousePosition.X > list_rect.Left) && (mer->dwMousePosition.X < list_rect.Right) && (mer->dwMousePosition.Y > list_rect.Top) && (mer->dwMousePosition.Y < list_rect.Bottom))
          {
            DlgProc(hDlg, DN_KEY, LIST_BOX, KEY_ENTER);
            return TRUE;
          }
          // pass message to scrollbar if needed
          if ((mer->dwMousePosition.X == list_rect.Right) && (mer->dwMousePosition.Y > list_rect.Top) && (mer->dwMousePosition.Y < list_rect.Bottom)) return FALSE;
          return TRUE;
        }
        else if (mer->dwButtonState == RIGHTMOST_BUTTON_PRESSED)
        {
          Info.SendDlgMessage(hDlg,DMU_UPDATE,0,2);
          return TRUE;
        }
      }
    }
    break;

    case DN_KEY:
      switch (Param2)
      {
        case KEY_F8:
        {
          if (ListSize)
          {
            TCHAR DlgText[MAX_PATH + 200];
            StringCchPrintf(DlgText, ARRAYSIZE(DlgText), GetMsg(MConfirm), p[Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,NULL)].Keys[DisplayName]);
            if (EMessage((const TCHAR * const *) DlgText, 0, 2) == 0)
            {
              if (!DeleteEntry(static_cast<int>(Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,NULL))))
                DrawMessage(FMSG_WARNING, 1, "%s",GetMsg(MPlugIn),GetMsg(MDelRegErr),GetMsg(MBtnOk),NULL);
              Info.SendDlgMessage(hDlg,DMU_UPDATE,1,0);
            }
          }
        }
        return TRUE;

        case (KEY_F9|KEY_SHIFT|KEY_ALT):
        case (KEY_F9):
        {
          Configure(0);
        }
        return TRUE;

        case KEY_CTRLR:
        {
          Info.SendDlgMessage(hDlg,DMU_UPDATE,1,0);
        }
        return TRUE;

        case KEY_INS:
        {
          Info.SendDlgMessage(hDlg,DMU_UPDATE,0,1);
        }
        return TRUE;

        case KEY_ENTER:
        case KEY_SHIFTENTER:
        {
          if (ListSize)
          {
            int liChanged = 0;
            int liSelected = 0, liFirst = -1;

            for (int i = 0; i < nCount; i++)
            {
               if (FLI[i].Flags & LIF_CHECKED)
               {
                 if (liFirst == -1)
                   liFirst = i;
                 liSelected++;
               }
            }

            if (liSelected <= 1)
            {
              int liAction = (Param2 == KEY_ENTER) ? Opt.EnterAction : Opt.ShiftEnterAction;
              int pos = (liFirst == -1) ? static_cast<int>(Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,NULL)) : liFirst;
              liChanged = ExecuteEntry(pos, liAction, (Opt.RunLowPriority!=0));
            }
            else
            {
              int liAction = (Param2 == KEY_ENTER) ? Opt.EnterAction : Opt.ShiftEnterAction;
              bool LowPriority = (Opt.RunLowPriority!=0);

              // Обязательно ожидание - два инсталлятора сразу недопускаются
              if (liAction == Action_Menu)
              {
                if (EntryMenu(0, liAction, LowPriority, liSelected) < 0)
                  return TRUE;
              }
              else if (liAction == Action_Uninstall)
                liAction = Action_UninstallWait;
              else if (liAction == Action_Modify)
                liAction = Action_ModifyWait;
              else if (liAction == Action_Repair)
                liAction = Action_RepairWait;
              
              for (int pos = 0; pos < nCount; pos++)
              {
                if (!(FLI[pos].Flags & LIF_CHECKED))
                  continue;
                struct FarListPos FLP;
                FLP.SelectPos = pos;
                FLP.TopPos = -1;
                Info.SendDlgMessage(hDlg,DM_LISTSETCURPOS,LIST_BOX,reinterpret_cast<LONG_PTR>(&FLP));
                int li = ExecuteEntry(pos, liAction, LowPriority);
                if (li == -1)
                  break; // отмена
                if (li == 1)
                  liChanged = 1;
              }
            }

            if (liChanged == 1)
            {
              Info.SendDlgMessage(hDlg,DMU_UPDATE,1,0);
            }
          }
        }
        return TRUE;

        case KEY_SHIFTINS:
        case KEY_CTRLV:
        {
          TCHAR * bufP = FSF.PasteFromClipboard();
          static TCHAR bufData[MAX_PATH];
          if (bufP)
          {
            StringCchCopy(bufData,ARRAYSIZE(bufData),bufP);
            FSF.DeleteBuffer(bufP);
            unQuote(bufData);
            FSF.LStrlwr(bufData);
            for (int i = lstrlen(bufData); i >= 1; i--)
              for (int j = 0; j < nCount; j++)
                if (strnstri(p[j].Keys[DisplayName],bufData,i))
                {
                  lstrcpyn(Filter,bufData,i+1);
                  Info.SendDlgMessage(hDlg,DMU_UPDATE,0,0);
                  return TRUE;
                }
          }
        }
        return TRUE;

        case KEY_DEL:
        {
          if (lstrlen(Filter) > 0)
          {
            StringCchCopy(Filter,ARRAYSIZE(Filter),_T(""));
            Info.SendDlgMessage(hDlg,DMU_UPDATE,0,0);
          }
        }
        return TRUE;

        case KEY_F3:
        case KEY_F4:
        {
          if (ListSize)
          {
            DisplayEntry(static_cast<int>(Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,LIST_BOX,NULL)));
            Info.SendDlgMessage(hDlg,DM_REDRAW,NULL,NULL);
          }
        }
        return TRUE;

        case KEY_F2:
        {
          Opt.SortByDate = !Opt.SortByDate;
          Info.SendDlgMessage(hDlg,DMU_UPDATE,1,0);
        }
        return TRUE;

        case KEY_BS:
        {
          if (lstrlen(Filter))
          {
            Filter[lstrlen(Filter)-1] = '\0';
            Info.SendDlgMessage(hDlg,DMU_UPDATE,0,0);
          }
        }
        return TRUE;

        default:
        {
          if (Param2 >= KEY_SPACE && Param2 < KEY_FKEY_BEGIN)
          {
            struct FarListInfo ListInfo;
            Info.SendDlgMessage(hDlg,DM_LISTINFO,LIST_BOX,reinterpret_cast<LONG_PTR>(&ListInfo));
            if ((lstrlen(Filter) < sizeof(Filter)) && ListInfo.ItemsNumber)
            {
              int filterL = lstrlen(Filter);
              Filter[filterL] = FSF.LLower(static_cast<unsigned>(Param2));
              Filter[filterL+1] = '\0';
              Info.SendDlgMessage(hDlg,DMU_UPDATE,0,0);
              return TRUE;
            }
          }
        }
      }
      return FALSE;

    case DN_CTLCOLORDIALOG:
      return Info.AdvControl(Info.ModuleNumber,ACTL_GETCOLOR,(void *)COL_MENUTEXT);

    case DN_CTLCOLORDLGLIST:
      if (Param1 == LIST_BOX)
      {
        FarListColors *Colors = (FarListColors *)Param2;
        int ColorIndex[] = { COL_MENUBOX, COL_MENUBOX, COL_MENUTITLE, COL_MENUTEXT, COL_MENUHIGHLIGHT, COL_MENUBOX, COL_MENUSELECTEDTEXT, COL_MENUSELECTEDHIGHLIGHT, COL_MENUSCROLLBAR, COL_MENUDISABLEDTEXT, COL_MENUARROWS, COL_MENUARROWSSELECTED, COL_MENUARROWSDISABLED };
        int Count = ARRAYSIZE(ColorIndex);
        if (Count > Colors->ColorCount)
          Count = Colors->ColorCount;
        for (int i = 0; i < Count; i++)
          Colors->Colors[i] = static_cast<BYTE>(Info.AdvControl(Info.ModuleNumber, ACTL_GETCOLOR, reinterpret_cast<void *>(ColorIndex[i])));
        return TRUE;
      }
    break;
  }
  return Info.DefDlgProc(hDlg,Msg,Param1,Param2);
}
Beispiel #7
0
BOOL CALLBACK PostNewsDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
   static HWND hEdit, hSubject;
   static PostNewsDialogStruct *info;
   char *buf, subject[MAX_SUBJECT];
   int len;
   MINMAXINFO *lpmmi;
   
   switch (message)
   {
   case WM_INITDIALOG:
      CenterWindow(hDlg, cinfo->hMain);
      info = (PostNewsDialogStruct *) lParam;

      hEdit = GetDlgItem(hDlg, IDC_NEWSEDIT);
      hSubject = GetDlgItem(hDlg, IDC_SUBJECT);

      Edit_LimitText(hEdit, MAXARTICLE);
      SetWindowFont(hEdit, GetFont(FONT_MAIL), TRUE);

      Edit_LimitText(hSubject, MAX_SUBJECT - 1);
      SetWindowFont(hSubject, GetFont(FONT_MAIL), TRUE);

      /* Store dialog rectangle in case of resize */
      GetWindowRect(hDlg, &dlg_rect);

      /* Set default subject if appropriate */
      if (info->subject != NULL)
      {
	 MakeReplySubject(info->subject, MAX_SUBJECT);
	 Edit_SetText(hSubject, info->subject);
	 SetFocus(hEdit);
      }
      else SetFocus(hSubject);

      /* Display group name */
      SetWindowText(GetDlgItem(hDlg, IDC_GROUPNAME), 
		    LookupNameRsc(info->group_name_rsc));
      
      EnableWindow(GetDlgItem(hDlg, IDOK), FALSE);
      hPostNewsDialog = hDlg;
      return FALSE;

      HANDLE_MSG(hDlg, WM_CTLCOLOREDIT, MailCtlColor);
      HANDLE_MSG(hDlg, WM_CTLCOLORLISTBOX, MailCtlColor);
      HANDLE_MSG(hDlg, WM_CTLCOLORSTATIC, MailCtlColor);
      HANDLE_MSG(hDlg, WM_CTLCOLORDLG, MailCtlColor);

   case WM_SIZE:
      ResizeDialog(hDlg, &dlg_rect, newssend_controls);
      return TRUE;      

   case WM_GETMINMAXINFO:
      lpmmi = (MINMAXINFO *) lParam;
      lpmmi->ptMinTrackSize.x = 200;
      lpmmi->ptMinTrackSize.y = 300;
      return 0;

   case WM_DESTROY:
      hPostNewsDialog = NULL;
      if (exiting)
	 PostMessage(cinfo->hMain, BK_MODULEUNLOAD, 0, MODULE_ID);
      return TRUE;

   case WM_COMMAND:
      UserDidSomething();

      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
      case IDC_NEWSEDIT:
	 if (GET_WM_COMMAND_CMD(wParam, lParam) != EN_CHANGE)
	    return TRUE;

	 /* Only allow user to post when article is nonempty */
	 if (Edit_GetTextLength(hEdit) > 0)
	    EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
	 else EnableWindow(GetDlgItem(hDlg, IDOK), FALSE);
	    
	 return TRUE;

      case IDOK:
	 /* Get title and article; post article */
	 Edit_GetText(hSubject, subject, MAX_SUBJECT);
	 
	 len = Edit_GetTextLength(hEdit);
	 buf = (char *) SafeMalloc(len + 1);
	 Edit_GetText(hEdit, buf, len + 1);
	 SendArticle(info->newsgroup, subject, buf);
	
	 SafeFree(buf);
	 EndDialog(hDlg, IDOK);
	 return TRUE;

      case IDCANCEL:
	 EndDialog(hDlg, IDCANCEL);
	 return TRUE;
      }
   }
   return FALSE;
}
Beispiel #8
0
BOOL CALLBACK SendMailDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
   static HWND hEdit, hSubject, hRecipients;
   static MailInfo *reply;
   MINMAXINFO *lpmmi;

   switch (message)
   {
   case WM_INITDIALOG:
      CenterWindow(hDlg, cinfo->hMain);

      hEdit = GetDlgItem(hDlg, IDC_MAILEDIT);
      hSubject = GetDlgItem(hDlg, IDC_SUBJECT);
      hRecipients = GetDlgItem(hDlg, IDC_RECIPIENTS);
      
      /* Store dialog rectangle in case of resize */
      GetWindowRect(hDlg, &dlg_rect);

      Edit_LimitText(hEdit, MAXMAIL - 1);
      Edit_LimitText(hSubject, MAX_SUBJECT - 1);
      Edit_LimitText(hRecipients, (MAXUSERNAME + 2) * MAX_RECIPIENTS - 1);
      SendMessage(hDlg, BK_SETDLGFONTS, 0, 0);
      EnableWindow(GetDlgItem(hDlg, IDOK), FALSE);

      hSendMailDlg = hDlg;

      // See if we should initialize dialog for a reply
      reply = (MailInfo *) lParam;
      if (reply != NULL)
      {
	 SendMailInitialize(hDlg, reply);
	 SetFocus(hEdit);
      }

      return 0;

   case WM_SIZE:
      ResizeDialog(hDlg, &dlg_rect, mailsend_controls);
      return TRUE;      

   case WM_GETMINMAXINFO:
      lpmmi = (MINMAXINFO *) lParam;
      lpmmi->ptMinTrackSize.x = 250;
      lpmmi->ptMinTrackSize.y = 200;
      return 0;

   case WM_ACTIVATE:
      if (wParam == 0)
	 *cinfo->hCurrentDlg = NULL;
      else *cinfo->hCurrentDlg = hDlg;
      return TRUE;

   case BK_SETDLGFONTS:
      SetWindowFont(hEdit, GetFont(FONT_MAIL), TRUE);
      SetWindowFont(hSubject, GetFont(FONT_MAIL), TRUE);
      SetWindowFont(hRecipients, GetFont(FONT_MAIL), TRUE);
      return TRUE;

   case BK_SETDLGCOLORS:
      InvalidateRect(hDlg, NULL, TRUE);
      return TRUE;

      HANDLE_MSG(hDlg, WM_CTLCOLOREDIT, MailCtlColor);
      HANDLE_MSG(hDlg, WM_CTLCOLORLISTBOX, MailCtlColor);
      HANDLE_MSG(hDlg, WM_CTLCOLORSTATIC, MailCtlColor);
      HANDLE_MSG(hDlg, WM_CTLCOLORDLG, MailCtlColor);

      HANDLE_MSG(hDlg, WM_INITMENUPOPUP, InitMenuPopupHandler);

   case WM_CLOSE:
      SendMessage(hDlg, WM_COMMAND, IDCANCEL, 0);
      break;

   case WM_DESTROY:
      hSendMailDlg = NULL;
      if (exiting)
	 PostMessage(cinfo->hMain, BK_MODULEUNLOAD, 0, MODULE_ID);
      break;

   case WM_COMMAND:
      UserDidSomething();

      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
      case IDCANCEL:
	 DestroyWindow(hDlg);
	 return TRUE;

      case IDOK:
	 /* User has pressed return somewhere */
	 if (GetFocus() == hSubject)
	    SetFocus(hEdit);
	 else if (GetFocus() == hRecipients)
	    SetFocus(hSubject);
	 return TRUE;

      case IDC_OK:
	 SendMailMessage(hDlg);
	 return TRUE;
      }
      break;
   }
   return FALSE;
}
Beispiel #9
0
/*
* DescDialogProc:  Dialog procedure for dialog containing an
*   item's long description.
*/
BOOL CALLBACK DescDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
	DescDialogStruct *info;
	static HWND hwndBitmap;
	static Bool changed;   // True when player has changed description
	HWND hEdit, hwndOK, hURL, hFixed;
	HDC hdc;
	HFONT hFont;
	RECT dlg_rect, edit_rect, fixed_rect;
	AREA area;
	char *desc, *str, url[MAX_URL + 1], *pPageBreak;
	DRAWITEMSTRUCT *lpdis;
	char descriptionBuffer[MAX_PAGE_DESCRIPTION_TEXT+1];
	int height;
	
	info = (DescDialogStruct *) GetWindowLong(hDlg, DWL_USER);
	
	switch (message)
	{
	case WM_INITDIALOG:
		info = (DescDialogStruct *) lParam;
		/* Store structure in dialog box's extra bytes */
		SetWindowLong(hDlg, DWL_USER, (long) info);
		
		hwndBitmap = GetDlgItem(hDlg, IDC_DESCBITMAP);
		hFixed = GetDlgItem(hDlg, IDC_DESCFIXED);
		hEdit = GetDlgItem(hDlg, IDC_DESCBOX);
		hwndOK = GetDlgItem(hDlg, IDOK);
		
		// Item Name.
		height = SetFontToFitText(info,GetDlgItem(hDlg, IDC_DESCNAME), 
			(int)FONT_TITLES, info->name);
		SetDlgItemText(hDlg, IDC_DESCNAME, info->name);
		hdc = GetDC(hDlg);
		SetTextColor(hdc,GetPlayerNameColor(info->obj,info->name));
		ReleaseDC(hDlg,hdc);
		
		// Item Description.
		hFont = GetFont(FONT_EDIT);
		SetWindowFont(hFixed, hFont, FALSE);
		SetWindowFont(hEdit, hFont, FALSE);
		
		str = info->description;
		if (str)
		{
			pPageBreak = strchr(str,PAGE_BREAK_CHAR);
			while (pPageBreak)
			{
				info->numPages++;
				str = pPageBreak+1;
				pPageBreak = strchr(str,PAGE_BREAK_CHAR);
			}
			info->numPages++;
			GetPageText(descriptionBuffer,info);
			Edit_SetText(hEdit, descriptionBuffer);
		}
		
		// Show fixed string, if appropriate
		if (info->fixed_string != NULL)
		{
			SetDlgItemText(hDlg, IDC_DESCFIXED, info->fixed_string);
			SetWindowFont(GetDlgItem(hDlg, IDC_DESCFIXED), GetFont(FONT_EDIT), FALSE);
		}
		
		// Can this player edit this object's description?
		if (info->flags & DF_EDITABLE)
			Edit_SetReadOnly(hEdit, FALSE);
		Edit_LimitText(hEdit, MAX_DESCRIPTION);
		if (!(info->flags & (DF_EDITABLE | DF_INSCRIBED)) && !str)
		{
			GetWindowRect(hFixed, &fixed_rect);
			GetWindowRect(hEdit, &edit_rect);
			UnionRect(&fixed_rect, &fixed_rect, &edit_rect);
			ScreenToClient(hDlg, (LPPOINT)(&fixed_rect));
			ScreenToClient(hDlg, (LPPOINT)(&fixed_rect)+1);
			MoveWindow(hFixed, fixed_rect.left, fixed_rect.top,
				fixed_rect.right - fixed_rect.left,
				fixed_rect.bottom - fixed_rect.top, FALSE);
			ShowWindow(hEdit, SW_HIDE);
		}
		
		// Resize and move dialog controls
		GetWindowRect(hDlg, &dlg_rect);
		if (GetWindowLong(hEdit, GWL_STYLE) & WS_VISIBLE)
		{
			ShowWindow(hEdit, SW_HIDE);
			ResizeEditToFitText(hFixed, hFont);
			ResizeDialog(hDlg, &dlg_rect, desc_controls);
			ShowWindow(hEdit, SW_SHOW);
		}
		else
		{
			ResizeEditToFitText(hFixed, hFont);
			ResizeDialog(hDlg, &dlg_rect, desc_controls);
		}
		if (GetWindowLong(hEdit, GWL_STYLE) & WS_VISIBLE)
		{
			GetWindowRect(hFixed, &fixed_rect);
			GetWindowRect(hEdit, &edit_rect);
			height = fixed_rect.bottom-edit_rect.top;
			ScreenToClient(hDlg, (LPPOINT)(&edit_rect));
			ScreenToClient(hDlg, (LPPOINT)(&edit_rect)+1);
			ShowWindow(hFixed, SW_HIDE);
			OffsetRect(&edit_rect, 0, height);
			MoveWindow(hEdit, edit_rect.left, edit_rect.top,
				edit_rect.right - edit_rect.left,
				edit_rect.bottom - edit_rect.top, FALSE);
			GetWindowRect(hDlg, &dlg_rect);
			ResizeEditToFitText(hEdit, hFont);
			ResizeDialog(hDlg, &dlg_rect, desc_controls);
			ShowWindow(hFixed, SW_SHOW);
		}
		
		CenterWindow(hDlg, GetParent(hDlg));
		
		// Show URL, if appropriate
		if (info->url != NULL)
		{
			hURL = GetDlgItem(hDlg, IDC_URL);
			
			SetWindowText(hURL, info->url);
			SetWindowFont(hURL, GetFont(FONT_EDIT), FALSE);
			
			if (info->flags & DF_EDITABLE)
				Edit_SetReadOnly(hURL, FALSE);
			
			Edit_LimitText(hURL, MAX_URL);
		}
		
		// Show appropriate buttons
		if (!(desc_flags & DESC_GET))
			DestroyWindow(GetDlgItem(hDlg, IDC_GET));
		if (!(desc_flags & DESC_DROP))
			DestroyWindow(GetDlgItem(hDlg, IDC_DROP));
		if (!(desc_flags & DESC_USE))
			DestroyWindow(GetDlgItem(hDlg, IDC_USE));
		if (!(desc_flags & DESC_UNUSE))
			DestroyWindow(GetDlgItem(hDlg, IDC_UNUSE));
		if (!(desc_flags & DESC_INSIDE))
			DestroyWindow(GetDlgItem(hDlg, IDC_INSIDE));
		if (!(desc_flags & DESC_ACTIVATE))
			DestroyWindow(GetDlgItem(hDlg, IDC_ACTIVATE));
		if (!(desc_flags & DESC_APPLY))
			DestroyWindow(GetDlgItem(hDlg, IDC_APPLY));
		
		SetLookPageButtons(hDlg, info);
#if 0
		if (info->numPages < 2)
		{
			HWND hwnd = GetDlgItem(hDlg,IDC_NEXT);
			if (hwnd)
				DestroyWindow(GetDlgItem(hDlg, IDC_NEXT));
			hwnd = GetDlgItem(hDlg,IDC_PREV);
			if (hwnd)
				DestroyWindow(GetDlgItem(hDlg, IDC_PREV));
		}
		else 
		{
			HWND hwnd = GetDlgItem(hDlg,IDC_PREV);
			if (hwnd)
				EnableWindow(hwnd,FALSE);
		}
#endif
		SetFocus(hwndOK);
		hDescDialog = hDlg;
		changed = False;
		return FALSE;
		
   case WM_PAINT:
	   InvalidateRect(hwndBitmap, NULL, TRUE);
	   UpdateWindow(hwndBitmap);
	   /* fall through */
	   
   case BK_ANIMATE:
	   /* Draw object's bitmap */
	   hdc = GetDC(hwndBitmap);
	   GetClientRect(hwndBitmap, &dlg_rect);
	   
	   RectToArea(&dlg_rect, &area);
	   DrawStretchedObjectGroup(hdc, info->obj, info->obj->animate->group, &area, 
		   GetSysColorBrush(COLOR_3DFACE));
	   
	   ReleaseDC(hwndBitmap, hdc);
	   break;
	   
	   HANDLE_MSG(hDlg, WM_CTLCOLOREDIT, DialogCtlColor);
	   HANDLE_MSG(hDlg, WM_CTLCOLORLISTBOX, DialogCtlColor);
	   HANDLE_MSG(hDlg, WM_CTLCOLORSTATIC, DialogCtlColor);
	   HANDLE_MSG(hDlg, WM_CTLCOLORDLG, DialogCtlColor);
	   
   case WM_DESTROY:
	   hDescDialog = NULL;
	   return TRUE;   
	   
   case WM_DRAWITEM:
	   // Draw player name in color that reflects murderer status
	   lpdis = (DRAWITEMSTRUCT *) lParam;
	   switch (lpdis->itemAction)
       {
       case ODA_SELECT:
       case ODA_DRAWENTIRE:
		   SelectPalette(lpdis->hDC, hPal, FALSE);
		   hFont = info->hFontTitle;
		   SelectObject(lpdis->hDC, hFont);
		   SetBkMode(lpdis->hDC, TRANSPARENT);
		   str = LookupNameRsc(info->obj->name_res);
		   SetTextColor(lpdis->hDC, NAME_COLOR_NORMAL_BG);
		   DrawText(lpdis->hDC, str, strlen(str), &lpdis->rcItem, DT_LEFT | DT_VCENTER | DT_NOPREFIX);
		   OffsetRect(&lpdis->rcItem, -1, -1);
		   SetTextColor(lpdis->hDC, GetPlayerNameColor(info->obj, info->name));
		   DrawText(lpdis->hDC, str, strlen(str), &lpdis->rcItem, DT_LEFT | DT_VCENTER | DT_NOPREFIX);
		   
		   break;
       }
	   return TRUE;
	   
	   case WM_COMMAND:
		   switch(GET_WM_COMMAND_ID(wParam, lParam))
		   {
		   case IDC_PREV:
			   if (info->currentPage > 0)
				   info->currentPage--;
			   GetPageText(descriptionBuffer,info);
			   SetLookPageButtons(hDlg, info);
			   Edit_SetText(GetDlgItem(hDlg, IDC_DESCBOX), descriptionBuffer);
#if 0
			   EnableWindow(GetDlgItem(hDlg,IDC_PREV),info->currentPage > 0);
			   EnableWindow(GetDlgItem(hDlg,IDC_NEXT),info->currentPage < info->numPages-1);
#endif
			   return TRUE;
			   
		   case IDC_NEXT:
			   if (info->currentPage < info->numPages-1)
				   info->currentPage++;
			   GetPageText(descriptionBuffer,info);
			   Edit_SetText(GetDlgItem(hDlg, IDC_DESCBOX), descriptionBuffer);
			   SetLookPageButtons(hDlg, info);
#if 0
			   EnableWindow(GetDlgItem(hDlg,IDC_PREV),info->currentPage > 0);
			   EnableWindow(GetDlgItem(hDlg,IDC_NEXT),info->currentPage < info->numPages-1);
#endif
			   return TRUE;
			   
		   case IDC_GET:
			   RequestPickup(info->obj->id);
			   EndDialog(hDlg, 0);
			   return TRUE;
			   
		   case IDC_DROP:
			   // Drop all of number items
			   info->obj->temp_amount = info->obj->amount;
			   RequestDrop(info->obj);
			   EndDialog(hDlg, 0);
			   return TRUE;
			   
		   case IDC_USE:
			   // If player isn't holding the object (i.e. there's a Get button), pick object up first
			   if (IsWindowVisible(GetDlgItem(hDlg, IDC_GET)))
				   RequestPickup(info->obj->id);
			   RequestUse(info->obj->id);
			   EndDialog(hDlg, 0);
			   return TRUE;
			   
		   case IDC_UNUSE:
			   RequestUnuse(info->obj->id);
			   EndDialog(hDlg, 0);
			   return TRUE;
			   
		   case IDC_INSIDE:
			   RequestObjectContents(info->obj->id);
			   EndDialog(hDlg, 0);
			   return TRUE;
			   
		   case IDC_ACTIVATE:
			   RequestActivate(info->obj->id);
			   EndDialog(hDlg, 0);
			   return TRUE;
			   
		   case IDC_APPLY:
			   StartApply(info->obj->id);
			   EndDialog(hDlg, 0);
			   return TRUE;
			   
		   case IDC_DESCBOX:
			   if (GET_WM_COMMAND_CMD(wParam, lParam) != EN_CHANGE)
				   break;
			   changed = True;
			   return TRUE;
			   
		   case IDC_URLBUTTON:
			   hURL = GetDlgItem(hDlg, IDC_URL);
			   Edit_GetText(hURL, url, MAX_URL);
			   WebLaunchBrowser(url);
			   return TRUE;
			   
		   case IDOK:
			   
			   // Send new description if changed
			   if (changed)
			   {
				   desc = (char *) SafeMalloc(MAX_DESCRIPTION + 1);
				   GetDlgItemText(hDlg, IDC_DESCBOX, desc, MAX_DESCRIPTION);
				   RequestChangeDescription(info->obj->id, desc);
				   SafeFree(desc);
			   }
			   
			   // Send new URL if changed
			   if (info->url != NULL)
			   {
				   GetDlgItemText(hDlg, IDC_URL, url, MAX_URL);
				   if (strcmp(url, info->url))
					   RequestChangeURL(player.id, url);
			   }
			   
			   // FALLTHRU
			   
		   case IDCANCEL:
			   SetWindowFont(GetDlgItem(hDlg,IDC_DESCNAME), GetFont(FONT_TITLES), FALSE);
			   if (info->hFontTitle && info->hFontTitle != GetFont(FONT_TITLES))
				   DeleteObject(info->hFontTitle);
			   info->hFontTitle = NULL;
			   
			   EndDialog(hDlg, IDOK == GET_WM_COMMAND_ID(wParam, lParam));
			   return TRUE;
      }
      break;
   }
   
   return FALSE;
}
Beispiel #10
0
BOOL CALLBACK ReadMailDialogProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
   static HWND hEdit, hList;
   static int mail_index;  /* Number of currently displayed message, -1 if none */
   MailHeader *header;
   int index, msg_num, count;
   char str[MAX_HEADERLINE], msg[MAXMAIL];
   MINMAXINFO *lpmmi;
   LV_COLUMN lvcol;
   LV_ITEM lvitem;
   LV_HITTESTINFO lvhit;
   NM_LISTVIEW *nm;

   switch (message)
   {
   case WM_INITDIALOG:
      CenterWindow(hDlg, cinfo->hMain);
      hReadMailDlg = hDlg;

      hEdit = GetDlgItem(hDlg, IDC_MAILEDIT);
      hList = GetDlgItem(hDlg, IDC_MAILLIST);
      SendMessage(hDlg, BK_SETDLGFONTS, 0, 0);

      ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT,
                                          LVS_EX_FULLROWSELECT);

      /* Store dialog rectangle in case of resize */
      GetWindowRect(hDlg, &dlg_rect);

      // Add column headings
      lvcol.mask = LVCF_TEXT | LVCF_WIDTH;
      lvcol.pszText = GetString(hInst, IDS_MHEADER1);
      lvcol.cx      = 25;
      ListView_InsertColumn(hList, 0, &lvcol);
      lvcol.pszText = GetString(hInst, IDS_MHEADER2);
      lvcol.cx      = 80;
      ListView_InsertColumn(hList, 1, &lvcol);
      lvcol.pszText = GetString(hInst, IDS_MHEADER3);
      lvcol.cx      = 150;
      ListView_InsertColumn(hList, 2, &lvcol);
      lvcol.pszText = GetString(hInst, IDS_MHEADER4);
      lvcol.cx      = 135;
      ListView_InsertColumn(hList, 3, &lvcol);

      mail_index = -1;

      SetFocus(hReadMailDlg);

      MailGetMessageList();
      RequestReadMail();
      return TRUE;

   case WM_SIZE:
      ResizeDialog(hDlg, &dlg_rect, mailread_controls);
      return TRUE;      

   case WM_GETMINMAXINFO:
      lpmmi = (MINMAXINFO *) lParam;
      lpmmi->ptMinTrackSize.x = 200;
      lpmmi->ptMinTrackSize.y = 300;
      return 0;

   case WM_ACTIVATE:
      if (wParam == 0)
	 *cinfo->hCurrentDlg = NULL;
      else *cinfo->hCurrentDlg = hDlg;
      return TRUE;
      
   case BK_SETDLGFONTS:
      SetWindowFont(hEdit, GetFont(FONT_MAIL), TRUE);
      SetWindowFont(hList, GetFont(FONT_MAIL), TRUE);
      return TRUE;
      
   case BK_SETDLGCOLORS:
      ListView_SetTextColor(hList, GetColor(COLOR_LISTFGD));
      ListView_SetBkColor(hList, GetColor(COLOR_LISTBGD));
      InvalidateRect(hDlg, NULL, TRUE);
      return TRUE;

   case EN_SETFOCUS:
      /* By default, whole message becomes selected for some reason */
      Edit_SetSel(hEdit, -1, 0);
      break;
      
   case BK_NEWMAIL: /* wParam = message number, lParam = message header string */
      msg_num = wParam;
      header = (MailHeader *) lParam;

      // Add message to list view
      sprintf(str, "%d", msg_num);
      lvitem.mask = LVIF_TEXT | LVIF_PARAM;
      lvitem.iItem = 0;
      lvitem.iSubItem = 0;
      lvitem.pszText = str;
      lvitem.lParam = msg_num;
      ListView_InsertItem(hList, &lvitem);

      // Add subitems
      lvitem.mask = LVIF_TEXT;
      lvitem.iSubItem = 1;
      lvitem.pszText = header->sender;
      ListView_SetItem(hList, &lvitem);
      lvitem.iSubItem = 2;
      lvitem.pszText = header->subject;
      ListView_SetItem(hList, &lvitem);
      lvitem.iSubItem = 3;
      lvitem.pszText = header->date;
      ListView_SetItem(hList, &lvitem);

      // Erase message in status area
      SetDlgItemText(hDlg, IDC_MAILINFO, "");
      return TRUE;
   
   case BK_NONEWMAIL:
      SetDlgItemText(hDlg, IDC_MAILINFO, GetString(hInst, IDS_NONEWMAIL));
      return TRUE;

      HANDLE_MSG(hDlg, WM_CTLCOLOREDIT, MailCtlColor);
      HANDLE_MSG(hDlg, WM_CTLCOLORLISTBOX, MailCtlColor);
      HANDLE_MSG(hDlg, WM_CTLCOLORSTATIC, MailCtlColor);
      HANDLE_MSG(hDlg, WM_CTLCOLORDLG, MailCtlColor);

      HANDLE_MSG(hDlg, WM_INITMENUPOPUP, InitMenuPopupHandler);
      
   case WM_CLOSE:
      SendMessage(hDlg, WM_COMMAND, IDCANCEL, 0);
      return TRUE;

   case WM_DESTROY:
      hReadMailDlg = NULL;
      if (exiting)
	 PostMessage(cinfo->hMain, BK_MODULEUNLOAD, 0, MODULE_ID);
      return TRUE;

   case WM_NOTIFY:
      if (wParam != IDC_MAILLIST)
	 return TRUE;

      nm = (NM_LISTVIEW *) lParam;

      switch (nm->hdr.code)
      {
      case NM_CLICK:
	 // If you click on an item, select it--why doesn't control work this way by default?
	 GetCursorPos(&lvhit.pt);
	 ScreenToClient(hList, &lvhit.pt);
	 lvhit.pt.x = 10;
	 index = ListView_HitTest(hList, &lvhit);

	 if (index == -1)
	    break;

	 ListView_SetItemState(hList, index, 
			       LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
	 break;

      case LVN_ITEMCHANGED:
	 // New item selected; get its message number
	 lvitem.mask = LVIF_STATE | LVIF_PARAM;
	 lvitem.stateMask = LVIS_SELECTED;
	 lvitem.iItem = nm->iItem;
	 lvitem.iSubItem = 0;
	 ListView_GetItem(hList, &lvitem);

	 if (!(lvitem.state & LVIS_SELECTED))
	    break;

	 msg_num = lvitem.lParam;
	 if (msg_num == mail_index)
	    break;
	 
	 if (MailLoadMessage(msg_num, MAXMAIL, msg) == False)
	 {
	    ClientError(hInst, hReadMailDlg, IDS_CANTLOADMSG);
	    break;
	 }

	 mail_index = msg_num;
	 Edit_SetText(hEdit, msg);
	 break;
      }
      return TRUE;

   case WM_COMMAND:
      UserDidSomething();

      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
      case IDC_DELETEMSG:
	 if (!ListViewGetCurrentData(hList, &index, &msg_num))
	    return TRUE;
	 
	 if (MailDeleteMessage(msg_num) == True)
	 {
	    /* Display new current message, if any */
	    Edit_SetText(hEdit, "");
	    ListView_DeleteItem(hList, index);

	    count = ListView_GetItemCount(hList);
	    if (count == 0)
	       return TRUE;

	    index = min(index, count - 1);  // in case last message deleted
	    ListView_SetItemState(hList, index, LVIS_SELECTED, LVIS_SELECTED);
	 }
	 return TRUE;

      case IDC_RESCAN:
	 SetDlgItemText(hDlg, IDC_MAILINFO, GetString(hInst, IDS_GETTINGMSGS));
	 RequestReadMail();
	 return TRUE;

      case IDC_SEND:
	 UserSendMail();
	 return TRUE;

      case IDC_REPLY:
      case IDC_REPLYALL:
	 /* Find message number for currently selected message */
	 if (!ListViewGetCurrentData(hList, &index, &msg_num))
	    return TRUE;

	 UserMailReply(msg_num, (Bool) (GET_WM_COMMAND_ID(wParam, lParam) == IDC_REPLYALL));
	 return TRUE;

      case IDCANCEL:
	 /* Note:  This code is also used by the WM_CLOSE message */
	 MailDeleteMessageList();
	 DestroyWindow(hDlg);
	 return TRUE;
      }
      break;
   }
   return FALSE;
}