Click here to Skip to main content
16,014,392 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questiongeting start and end address of a running process? Pin
hwnd1-Jun-02 6:26
hwnd1-Jun-02 6:26 
AnswerRe: geting start and end address of a running process? Pin
Mike Nordell1-Jun-02 7:02
Mike Nordell1-Jun-02 7:02 
GeneralLimiting Characters in Edit Box :: MFC Pin
valikac1-Jun-02 5:30
valikac1-Jun-02 5:30 
GeneralRe: Limiting Characters in Edit Box :: MFC Pin
Joaquín M López Muñoz1-Jun-02 5:38
Joaquín M López Muñoz1-Jun-02 5:38 
GeneralRe: Limiting Characters in Edit Box :: MFC Pin
dlhson1-Jun-02 5:49
dlhson1-Jun-02 5:49 
GeneralRe: Limiting Characters in Edit Box :: MFC Pin
valikac1-Jun-02 6:15
valikac1-Jun-02 6:15 
GeneralRe: Limiting Characters in Edit Box :: MFC Pin
Michael P Butler1-Jun-02 7:22
Michael P Butler1-Jun-02 7:22 
GeneralSolution Pin
valikac1-Jun-02 7:15
valikac1-Jun-02 7:15 
Okay.

The solution is to use a CString variable holding the value of the edit box. I am referring to the example of the five digit zip code. For example, lets consider that the variable is an int. If the variable is declared as an int, there will be an overflow if the user enters 99999999999999. The solution I came up with is to define it as a CString. Here is the verification part.

-----
void CMyDlg::OnEnChangeMyEditBox()
{
UpdateData(TRUE);


// the length must be exactly five
// the value must be between 10000 and 91000

if (m_EditPortListen.GetLength() == 5 &&
atoi(static_cast<lpctstr>(m_MyEditBox)) >= 10000 &&
atoi(static_cast<lpctstr>(m_MyEditBox)) <= 91000)
SetModified(TRUE);

else
{
m_MyEditBox.Format("%d", 10000);
UpdateData(FALSE);
SetModified(FALSE);
}
}
-----

The code above works well.

Kuphryn
QuestionUsing Unicode in Editbox, ListControl and CString ? Pin
dlhson1-Jun-02 4:09
dlhson1-Jun-02 4:09 
AnswerRe: Using Unicode in Editbox, ListControl and CString ? Pin
Paul M Watt1-Jun-02 18:22
mentorPaul M Watt1-Jun-02 18:22 
QuestionGet char pos of RichEditControl ? Pin
dlhson1-Jun-02 3:58
dlhson1-Jun-02 3:58 
AnswerRe: Get char pos of RichEditControl ? Pin
Ed Gadziemski1-Jun-02 10:56
professionalEd Gadziemski1-Jun-02 10:56 
GeneralRetrieve "Data traffic" Pin
XAlien1-Jun-02 3:16
XAlien1-Jun-02 3:16 
GeneralRe: Retrieve "Data traffic" Pin
Paul M Watt1-Jun-02 8:33
mentorPaul M Watt1-Jun-02 8:33 
GeneralRe: Retrieve "Data traffic" Pin
XAlien1-Jun-02 23:05
XAlien1-Jun-02 23:05 
GeneralListBox controls Pin
1-Jun-02 3:19
suss1-Jun-02 3:19 
GeneralRe: ListBox controls Pin
XAlien1-Jun-02 3:21
XAlien1-Jun-02 3:21 
GeneralRe: ListBox controls Pin
1-Jun-02 6:00
suss1-Jun-02 6:00 
GeneralRe: ListBox controls Pin
XAlien1-Jun-02 23:02
XAlien1-Jun-02 23:02 
GeneralDifferent results with debug and release version Pin
George Ma1-Jun-02 2:33
George Ma1-Jun-02 2:33 
GeneralRe: Different results with debug and release version Pin
Michael P Butler1-Jun-02 2:37
Michael P Butler1-Jun-02 2:37 
GeneralRe: Different results with debug and release version Pin
George Ma1-Jun-02 18:12
George Ma1-Jun-02 18:12 
GeneralRe: Different results with debug and release version Pin
1-Jun-02 18:39
suss1-Jun-02 18:39 
GeneralTCP/IP on TAPI Pin
Sameer Maggon1-Jun-02 2:25
Sameer Maggon1-Jun-02 2:25 
GeneralRe: TCP/IP on TAPI Pin
Michael P Butler1-Jun-02 2:36
Michael P Butler1-Jun-02 2:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.