home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / mswindo / programm / misc / 1582 < prev    next >
Encoding:
Text File  |  1992-08-30  |  2.5 KB  |  77 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!usc!cs.utexas.edu!torn!maccs!howard
  3. From: howard@maccs.dcss.mcmaster.ca (Howard Betel)
  4. Subject: Help with dialog msgs, please
  5. Message-ID: <1992Aug31.023637.28589@maccs.dcss.mcmaster.ca>
  6. Organization: Department of Computer Science, McMaster University
  7. Date: Mon, 31 Aug 1992 02:36:37 GMT
  8. Lines: 67
  9.  
  10. The following code, was extracted from the case WM_COMMAND section
  11. of the dialog box. When moving from one edit control to another with both
  12. fields being empty a EN_KILLFOCUS is sent to both edit controls.
  13.  
  14. Could someone please help me change the following code so that a
  15. EN_KILLFOCUS message is sent to the leaving field.
  16.  
  17. I have been able to determine that it looks like the MessageBox is causing
  18. a EN_KILLFOCUS message to be sent to the target field.
  19.  
  20. ----------------------------------------------------------------------------
  21. case dfEPsword: /* Edit Control                             */
  22.   switch(HIWORD(lParam))
  23.   {
  24.     case EN_KILLFOCUS:
  25.         GetDlgItemText(hWndDlg, dfEPsword, epsword, 10);
  26.     if (strlen(epsword) != 8)
  27.     /* Check length of EDSNET Current Password        */
  28.     {
  29.            MessageBeep(NULL);
  30.            MessageBox(hWndDlg,
  31.               "EDSNET Current Password must be a 8 character alphanumeric string.",
  32.               "EDSNET Current Password",
  33.               MB_ICONHAND|MB_OK);
  34.            SendDlgItemMessage(hWndDlg,
  35.               dfEPsword,
  36.               EM_SETSEL,
  37.               NULL,
  38.               MAKELONG(0, 0x7ffff));
  39.            SetFocus(GetDlgItem(hWndDlg, dfEPsword));
  40.            return FALSE;
  41.         }
  42.     break;
  43.   }
  44. break;
  45.  
  46. case dfEAPsword: /* Edit Control                            */
  47.   switch(HIWORD(lParam))
  48.   {
  49.     case EN_KILLFOCUS:
  50.     GetDlgItemText(hWndDlg, dfEAPsword, eapsword, 10);
  51.     if (strlen(eapsword) != 8)
  52.     /* Check length of EDSNET Alternate Password    */
  53.     {
  54.            MessageBeep(NULL);
  55.            MessageBox(hWndDlg,
  56.               "EDSNET Alternate Password must be a 8 character alphanumeric string.",
  57.               "EDSNET Alternate Password",
  58.               MB_ICONHAND|MB_OK);
  59.            SendDlgItemMessage(hWndDlg,
  60.               dfEAPsword,
  61.               EM_SETSEL,
  62.               NULL,
  63.               MAKELONG(0, 0x7ffff));
  64.            SetFocus(GetDlgItem(hWndDlg, dfEAPsword));
  65.            return FALSE;
  66.         }
  67.     break;
  68.   }
  69. break;
  70.  
  71. Thanks,
  72.  
  73. -- 
  74. Howard Betel                                    Howard@maccs.dcss.McMaster.CA
  75. Dept of Computer Science                     ...!unet!utai!utgpu!maccs!howard
  76. McMaster University
  77.