I need to format the output text. It's easy to do this by using function TabbedTextOut() in Win32 platform. But I have to implement this function myself in WinCE platform. And I named it CeTabbedTextOut(). All input parameters are same to function TabbedTextOut(), but function type is void, not LONG. I know I did a lazy thing.
void CeTabbedTextOut(HDC hDC,               // handle to DC
            int X,                          // x-coord of start
            int Y,                          // y-coord of start
            LPCTSTR lpString,               // character string
            int nCount,                     // number of characters
            int nTabPositions,              // number of tabs in array
            CONST LPINT lpnTabStopPositions,// array of tab positions
            int nTabOrigin                  // start of tab expansion
            )
{
	CString sTabString = lpString; 
	int nNextTabCharPos = sTabString.Find(L"\t");
	// if first tab character postion is not the start of tab expansion
	if( nTabOrigin > 0)  
	{
		int nTabCount = 0;
		do{
			nNextTabCharPos = sTabString.Find(L"\t", nNextTabCharPos+1);
			nTabCount++;
			if(nNextTabCharPos == -1)
				break;
		} while (nTabCount != nTabOrigin);
	}
	else if (nTabOrigin < 0)
	{
	    // set first tab character position as the start of tab expansion
		nTabOrigin = 0; 
	}
	// Initialize the rectangle in which the text is to be formatted
	RECT Rect;
	Rect.left = X;
	Rect.top = Y;
	Rect.bottom = Rect.top + 20;
	Rect.right = X + lpnTabStopPositions[nTabOrigin];

	CString sTemp = _T("");
	for(int i=nTabOrigin; i<nTabPositions; i++)
	{
		if( nNextTabCharPos != -1 )
		{
			sTemp = sTabString.Left(nNextTabCharPos+1);
			sTabString = sTabString.Right(nCount - nNextTabCharPos-1);
			DrawText(hDC, sTemp, sTemp.GetLength(), &Rect,
				DT_EXPANDTABS | DT_NOCLIP);
			// get the length of the remanent character string
			nCount = nCount - sTemp.GetLength(); 
		}
		// if there is no remanent character string 
		// or the character string doesn't contain tab characters 
		if(nCount == 0 || nNextTabCharPos == -1)
		{
			break;
		}
		nNextTabCharPos = sTabString.Find(L"\t");
		Rect.left  = X + lpnTabStopPositions[i];
		if(i<nTabPositions-1)
		{
			Rect.right = X + lpnTabStopPositions[i+1];
		}
	}
	// writes the remanent character string that maybe contain tab characters
	if(nCount != 0)
	{
		ExtTextOut(hDC, Rect.left, Rect.top, 0, NULL,
			sTabString, sTabString.GetLength(), NULL);
	}
}

I know it's not a good function, and any suggestion or tip is welcome.