Click here to Skip to main content
15,903,175 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Upper Bound and Lower Bound of an array Pin
Andrew Brock4-Feb-11 1:52
Andrew Brock4-Feb-11 1:52 
GeneralRe: Upper Bound and Lower Bound of an array Pin
Niklas L4-Feb-11 2:19
Niklas L4-Feb-11 2:19 
AnswerRe: Upper Bound and Lower Bound of an array Pin
Hans Dietrich4-Feb-11 2:01
mentorHans Dietrich4-Feb-11 2:01 
AnswerRe: Upper Bound and Lower Bound of an array [SOLVED] Pin
Pranit Kothari6-Feb-11 7:14
Pranit Kothari6-Feb-11 7:14 
QuestionReleaseBuffer() of CSimpleString is not working. Pin
Amrit Agr3-Feb-11 18:55
Amrit Agr3-Feb-11 18:55 
AnswerRe: ReleaseBuffer() of CSimpleString is not working. Pin
Andrew Brock3-Feb-11 19:10
Andrew Brock3-Feb-11 19:10 
GeneralRe: ReleaseBuffer() of CSimpleString is not working. Pin
Amrit Agr3-Feb-11 21:38
Amrit Agr3-Feb-11 21:38 
QuestionDos command Pin
MsmVc3-Feb-11 18:17
MsmVc3-Feb-11 18:17 
QuestionRe: Dos command Pin
Rajesh R Subramanian3-Feb-11 18:39
professionalRajesh R Subramanian3-Feb-11 18:39 
AnswerRe: Dos command Pin
Andrew Brock3-Feb-11 18:49
Andrew Brock3-Feb-11 18:49 
GeneralRe: Dos command Pin
MsmVc4-Feb-11 0:27
MsmVc4-Feb-11 0:27 
AnswerRe: Dos comman Pin
Cool_Dev3-Feb-11 23:03
Cool_Dev3-Feb-11 23:03 
AnswerRe: Dos command Pin
csrss3-Feb-11 23:25
csrss3-Feb-11 23:25 
GeneralRe: Dos command Pin
MsmVc4-Feb-11 1:11
MsmVc4-Feb-11 1:11 
QuestionWould you all call this namespace abuse? Pin
asincero3-Feb-11 14:06
asincero3-Feb-11 14:06 
AnswerRe: Would you all call this namespace abuse? Pin
Madhu Nair3-Feb-11 16:33
Madhu Nair3-Feb-11 16:33 
GeneralRe: Would you all call this namespace abuse? Pin
asincero3-Feb-11 16:45
asincero3-Feb-11 16:45 
GeneralRe: Would you all call this namespace abuse? Pin
Stefan_Lang3-Feb-11 21:55
Stefan_Lang3-Feb-11 21:55 
AnswerRe: Would you all call this namespace abuse? Pin
Alain Rist3-Feb-11 20:31
Alain Rist3-Feb-11 20:31 
QuestionRe: Would you all call this namespace abuse? Pin
bob169724-Feb-11 5:03
bob169724-Feb-11 5:03 
QuestionChange Image size Pin
john56322-Feb-11 20:32
john56322-Feb-11 20:32 
AnswerRe: Change Image size Pin
Madhu Nair2-Feb-11 21:17
Madhu Nair2-Feb-11 21:17 
AnswerRe: Change Image size Pin
S p k 5213-Feb-11 1:00
S p k 5213-Feb-11 1:00 
AnswerRe: Change Image size Pin
Cool_Dev3-Feb-11 2:01
Cool_Dev3-Feb-11 2:01 
QuestionError in Release() throw function Pin
Anu_Bala2-Feb-11 19:30
Anu_Bala2-Feb-11 19:30 
Im using VS2008.
Im sending data to LED in external device thorugh serial port by given in set of format for glowing LED.
But it show error on Release() in nRef!=0 line.
Actually it works fine in VC6.0Now im converting that to VS2008.

struct SLEDFrame
{
	char *idtfr,*Data1,*Data2;
};

SLEDFrame btnLED[] = {
						
"0x53", "0x30", "0x30", 		//0			
"0x53", "0x30", "0x31",  		//1	
"0x53", "0x30", "0x32",  		//2	
"0x53", "0x30", "0x33",  		//3	
"0x53", "0x30", "0x34",  		//4
};

void CMSCOMMDlg::setLED(int pLEDNo, BOOL pState)
{

	BYTE bID, bByte1, bByte2, bState, bCheckSumByte1, bCheckSumByte2;

	if (pState)
		bState = 0x31;   //ON
	else 
		bState = 0x30;   //OFF
	

CString tempStr, C1, C2;

tempStr = btnLED[pLEDNo-1].idtfr;
tempStr = tempStr.Mid(2);    
sscanf(tempStr, "%x", &bID);

tempStr = btnLED[pLEDNo-1].Data1;
tempStr = tempStr.Mid(2);    
sscanf(tempStr, "%x", &bByte1);

tempStr = btnLED[pLEDNo-1].Data2;
tempStr = tempStr.Mid(2);    
sscanf(tempStr, "%x", &bByte2);

BYTE bSum = bByte1 + bByte2 + bState; 	
tempStr.Format("%x",bSum);

C1 = "0x3" + tempStr.Left(1);
C2 = "0x3" + tempStr.Right(1);
sscanf(C1, "%x", &bCheckSumByte1);
sscanf(C2, "%x", &bCheckSumByte2);


	//To send data use this code:
	CByteArray btArray;
 
	btArray.Add (bID); 	  		//Identifier byte
	btArray.Add (bByte1); 		// DataByte 1
	btArray.Add (bByte2); 		// DataByte 2
	btArray.Add (bState); 		//Status Byte
	btArray.Add (bCheckSumByte1); 	//CheckSumByte1
	btArray.Add (bCheckSumByte2); 	//CheckSumByte2
	
	COleVariant var(btArray);
	m_Comm.SetOutput(var);	// Send the data. 

	
} //It shows the error when the cursor comes out of this function.

The error occurs in
void Release() throw()
{
ATLASSERT( nRefs != 0 );
if( _AtlInterlockedDecrement( &nRefs ) <= 0 )
{
pStringMgr->Free( this );
}
}

Anu

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.