Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/16/08 02:56
Read: times


 
#153422 - Hopefully I can answer this correctly
Responding to: ???'s previous message
Appologies Russ, I thought I did answer the questions, I'll try again:

You've shown a bit of code. I suppose it's extracted from some event handler function that's magically called by the MFC framework. Is that correct?

The handler is the OnchangeEdit()

If so, which handler function is it?

Its when I double click on the edit box, the variable m_strDeviceAddress is defined in the classwizard as a Cstring


void CHC_controllerDlg::OnChangeDevice() 
{
	
	
	UpdateData(TRUE);			// get data from the GUI
	byte byReadData[2];//input array place holder
	for (int i = 0; i < 1; i++)
	{
		byReadData[0] = (byte)strtoul( m_strDeviceAddress, NULL, 16 ) ;;//array variable one
		byReadData[0] = ("%x", byReadData[0]);
	}
	
	for (i = 0; i < 1; i++)
	{
		byReadData[1] = (byte)strtoul( m_strDeviceAddress, NULL, 16 ) ;;//array variable one
		byReadData[1] = ("%x", byReadData[1]);
	}	
	
	
	byte byValue1 = byReadData[0];
	byte byValue2 = byReadData[1];

	//byValue = ((BYTE)strtoul(m_strDeviceAddress, NULL, 16);
   
	
	byte byValue = (byValue2) & (byValue1)  ;

	
	device = byValue;
	//m_strDeviceAddress.FormatMessage("0x%x", device) ;
    m_strDeviceAddress.Empty();
	m_strDeviceAddress.Format("0x", byValue1);
	byte temp = (byte)strtoul( m_strDeviceAddress, NULL, 16 ) ;;//array variable one
	m_strDeviceAddress.FormatMessage("%x", byValue2); 


	allset |=0x8;				// set bit 3 to indicate device is set
	UpdateData(FALSE);

	
	
}



If not, what then?

I think its defined above????....I hope

What, exactly, do you mean by the statement "I've found that the edit box is either set to "CString" or "CEdit" but not both ..."?

When I check the classwizard by clicking on the edit box in question, and you go to member variables, you can add a varible to the control ID, from what I can see in the classwizard, from the pulldown, you can select either Cstring OR Cedit for the variable type. Since the string needs to be converted from string to unsigned long, I believe the person that wrote the original code was presented with the same option. It seems you can only make it a Cstring or a Cedit.....from my limited experience with the class wizard.......as Andy Neil seems to want to point out.

The edit box is almost certainly an object of type CEdit. I don't understand what you mean when you talk about "setting" it to some other type. Do you mean that you are assigning the CEdit box to a CString object?

I think so, I understand that MFC is a wrapper around the windows API, I'm reading through book you mentioned....hopefully it can be helpful......




List of 18 messages in thread
TopicAuthorDate
C++, 8051, cleaning up a mess......need advise            01/01/70 00:00      
   Trying to convert after typing is too hard            01/01/70 00:00      
   Take a look here...            01/01/70 00:00      
      I gave that a run,            01/01/70 00:00      
   Maybe this will help            01/01/70 00:00      
      Thanks Russ, some thoughts            01/01/70 00:00      
         More thoughts            01/01/70 00:00      
            Your right, you know how it is            01/01/70 00:00      
      Is this it?            01/01/70 00:00      
         Well, no            01/01/70 00:00      
            Hopefully I can answer this correctly            01/01/70 00:00      
               Is Prosise onlin?            01/01/70 00:00      
                  Emailed link to you            01/01/70 00:00      
               Two more questions            01/01/70 00:00      
                  Placeholders for array data            01/01/70 00:00      
               Stop now, before you make things worse!            01/01/70 00:00      
                  No offense taken at all            01/01/70 00:00      
                     I got the link            01/01/70 00:00      

Back to Subject List