Exemplo n.º 1
0
void GDisplay::SaveAsBitmap(LPCTSTR pszFileName)
{
	HDC hdcClient = GetDC(m_hWnd); 
	HDC hdcCompatible = CreateCompatibleDC(hdcClient); 
 

	HBITMAP hBmp = CreateCompatibleBitmap(hdcClient, m_nClientWidth, m_nClientHeight);
	HGDIOBJ hOldBmp = SelectObject(hdcCompatible, hBmp); 

	BitBlt(hdcCompatible, 
		0,0, 
		m_nClientWidth, m_nClientHeight, 
		hdcClient, 
		0,0, 
		SRCCOPY);
	
	
	PBITMAPINFO pbi = CreateBitmapInfoStruct(hBmp);
	if (!CreateBMPFile(pszFileName, pbi, hBmp, hdcCompatible))
	{
		AfxGetApp()->Error(IDS_ERROR_CREATE_BMP);
	}

	SelectObject(hdcCompatible, hOldBmp);
	DeleteDC(hdcCompatible);
	DeleteObject(hBmp); 

}
Exemplo n.º 2
0
void CaptureUseDC()
{
    TCHAR filename[MAX_PATH] = { 0 };
    HDC compatibleHDC = NULL;
    HBITMAP compatibleHbitmap = NULL;

    compatibleHDC = NULL;
    compatibleHbitmap = NULL;
    GetCurDisplay(compatibleHDC, compatibleHbitmap);
    BITMAPINFO rBmpinfo = { 0 };
    GetBitmapInfo(rBmpinfo, compatibleHbitmap);

    ZeroMemory(filename, sizeof(filename));
    _stprintf_s(filename, MAX_PATH, L"%d.bmp", GetTickCount());
    CreateBMPFile(filename, &rBmpinfo, compatibleHbitmap, compatibleHDC);
    DeleteDC(compatibleHDC);
    DeleteObject(compatibleHbitmap);
}
Exemplo n.º 3
0
void WINAPI GenerateBMPW(LPWSTR fileName, LPWSTR text, int margin, int size)
{
	if (fileName == NULL)
		return;

	HBITMAP bmp = GetHBitmap(text, margin, size);
	if (bmp == NULL)
		return;
	
	PBITMAPINFO info = CreateBitmapInfoStruct(bmp);
	if (info != NULL)
	{
		HDC hdc = GetDC(0);
		CreateBMPFile(fileName, info, bmp, hdc);
		ReleaseDC(0, hdc);
		DeleteObject(bmp);
		LocalFree(info);
	}

}
Exemplo n.º 4
0
void generateBitmap(Map<Surface> map, int n, int m, LPTSTR name)
{
	int ppc = ::config::pixels_per_cell;

	HWND hwnd = ::GetActiveWindow();
	HDC hDC = GetDC(hwnd);
	HDC memDC = CreateCompatibleDC(hDC);
	HBITMAP memBM = CreateCompatibleBitmap(hDC, n * ppc, m * ppc);
	SelectObject(memDC, memBM);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			for (int x = i * ppc; x < (i + 1) * ppc; ++x)
				for (int y = j * ppc; y < (j + 1) * ppc; ++y)
					SetPixel(memDC, x, y, map[i][j].color);
		}
	}

	CreateBMPFile(hwnd, name, CreateBitmapInfoStruct(hwnd, memBM), memBM, memDC);

	DeleteObject(memBM);
	ReleaseDC(hwnd, memDC);
}
  //
  // Entry point for conversion
  //
UT_Error IE_ImpGraphic_Win32Native::_convertGraphic(UT_ByteBuf * pBB, std::string& mimetype)
{	
    IPicture* pPicture = NULL;
    IStream* stream;	
    HGLOBAL hG;		
    HBITMAP hBitmap;
    OLE_HANDLE* hB;
    PBITMAPINFO	bi;
    UT_ByteBuf bBufBMP;
    UT_Error err;	

	/* If the system has GDI+, use it*/
	if (isGDIPlusAvailable())
	{
		m_pBB = new UT_ByteBuf();
		return GDIconvertGraphic(pBB, m_pBB, mimetype);		
	}

	// the code below always writes out PNG's for now; we could update it to support
	// native JPEG images as well, or just delete it and always use GDI+.
	mimetype = "image/png";

    // We need to store the incoming bytebuffer in a Windows global heap	
    size_t nBlockLen = pBB->getLength();   	
    hG = GlobalAlloc(GPTR, nBlockLen);
    if (!hG) 
		return UT_IE_NOMEMORY;	
    
    CopyMemory(hG, pBB->getPointer(0), nBlockLen);   	
    
    // Create a stream from heap
    HRESULT hr = CreateStreamOnHGlobal(hG,false,&stream);
    if (!SUCCEEDED(hr) || !stream)
	{
		GlobalFree(hG);
		return UT_IE_NOMEMORY;
	}
    
    hr = OleLoadPicture(stream,0,false,IID_IPicture,(void**)&pPicture);	

    stream->Release();
    GlobalFree(hG);
    
    if (!SUCCEEDED(hr) || !pPicture)
	{
		return UT_IE_UNKNOWNTYPE;
	}

    pPicture->get_Handle((unsigned int*)&hB);
    
    hBitmap = (HBITMAP)CopyImage(hB,IMAGE_BITMAP,0,0,LR_COPYRETURNORG);
    
    HWND hWnd = GetDesktopWindow();
    
    // Create a BMP file from a BITMAP	
    bi = CreateBitmapInfoStruct(hBitmap);						
    CreateBMPFile(hWnd, bBufBMP, bi, hBitmap, GetDC(hWnd));
    LocalFree ((HLOCAL)bi);
    
    InitializePrivateClassData();
    
    /* Read Header Data */
    err = Read_BMP_Header(&bBufBMP);
	
	/* 
	   It's not a bitmap, then we have to rendered it into a device
	   context and get a bitmap from there. Case wmf graphics
	*/
	if (err) 
	{
		if (err!=UT_IE_BOGUSDOCUMENT) 
		{
			pPicture->Release();
			return err;		
		}
		
        long nWidth  = 0;
        long nHeight = 0;
		long nScaleToWidth= 500;
		long nScaleToHeight= 500;		
		RECT rc, rect;				
		BYTE *imagedata;
		HBITMAP hBit;
		HBITMAP hOld;
		BITMAPINFO bmi; 		
		HDC hWndDC = GetDC(hWnd);
		HDC	hMemDC = CreateCompatibleDC(hWndDC);
		HBRUSH hBrush = (HBRUSH)GetCurrentObject(hMemDC, OBJ_BRUSH);
		
		pPicture->get_Width (&nWidth);
		pPicture->get_Height(&nHeight);

		bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 	
		bmi.bmiHeader.biWidth = nScaleToWidth;
		bmi.bmiHeader.biHeight = nScaleToHeight;
		bmi.bmiHeader.biPlanes = 1; 
		bmi.bmiHeader.biBitCount = 24; // as we want true-color
		bmi.bmiHeader.biCompression = BI_RGB; // no compression
		bmi.bmiHeader.biSizeImage = (((bmi.bmiHeader.biWidth * bmi.bmiHeader.biBitCount + 31) & ~31) >> 3) * bmi.bmiHeader.biHeight; 
		bmi.bmiHeader.biXPelsPerMeter = 0;
		bmi.bmiHeader.biYPelsPerMeter = 0; 
		bmi.bmiHeader.biClrImportant = 0;
		bmi.bmiHeader.biClrUsed = 0; // we are not using palette
			
		hBit = CreateDIBSection(hMemDC,&bmi,DIB_RGB_COLORS,(void**)&imagedata,0,0);						
		hOld = (HBITMAP) SelectObject(hMemDC, hBit);			

		
		rect.left = 0;
        rect.top = nScaleToHeight;
        rect.right = nScaleToWidth;
        rect.bottom = 0;

		FillRect(hMemDC, &rect,  hBrush);
		pPicture->Render(hMemDC, 0,0,  nScaleToWidth,	nScaleToHeight, 0,  nHeight, 
						 nWidth, -nHeight, &rc);	
		
		hBit =  (HBITMAP)SelectObject(hMemDC, hOld);
		
		bi =  CreateBitmapInfoStruct(hBit);						
		CreateBMPFile(hWnd, bBufBMP, &bmi, hBit, hMemDC);
		LocalFree ((HLOCAL)bi);

		
		DeleteDC(hMemDC);
		DeleteDC(hWndDC);
	    DeleteObject(hBrush); 
		DeleteObject(hBit);	  
    
		err = Read_BMP_Header(&bBufBMP);
		if (err) 
		{
			pPicture->Release();
			return err;				
		}
		
	}

	pPicture->Release();


    if ((err = Initialize_PNG()))
	{   
		return err;
	}	
    
    /* Read Palette, if no palette set Header accordingly */
    if(m_iBitsPerPlane < 24) 
	{
		if ((err = Convert_BMP_Palette(&bBufBMP))) 
			return err;
	}
    else
	{
		UT_uint16 bitsPerChannel;
		UT_uint16 colorType;

		if (m_iBitsPerPlane == 24) {
			bitsPerChannel = 8;
			colorType = PNG_COLOR_TYPE_RGB;
		} else if (m_iBitsPerPlane == 32) {
			bitsPerChannel = 8;
			colorType = PNG_COLOR_TYPE_RGB_ALPHA;
		} else if (m_iBitsPerPlane == 48) {
			bitsPerChannel = 16;
			colorType = PNG_COLOR_TYPE_RGB;
		} else if (m_iBitsPerPlane == 64) {
			bitsPerChannel = 16;
			colorType = PNG_COLOR_TYPE_RGB_ALPHA;
		} else {		   
			return UT_ERROR;
		}
	
		png_set_IHDR ( m_pPNG,
					   m_pPNGInfo,
					   m_iWidth,
					   m_iHeight,
					   bitsPerChannel,
					   colorType,
					   PNG_INTERLACE_NONE,
					   PNG_COMPRESSION_TYPE_DEFAULT,
					   PNG_FILTER_TYPE_DEFAULT );
	
	}
    if ((err = Convert_BMP(&bBufBMP))) 
	{
		return err;
	}
    
    /* Clean Up Memory Used */
		
    FREEP(m_pPNGInfo->palette);	
    png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);
    
    return UT_OK;  	  	
}
Exemplo n.º 6
0
int main()
{
// Create a normal DC and a memory DC for the entire screen. The
// normal DC provides a "snapshot" of the screen contents. The
// memory DC keeps a copy of this "snapshot" in the associated
// bitmap.
HDC hdcScreen, hdcCompatible;
HBITMAP hbmScreen;
SYSTEMTIME time;
char* filename;
char* filepath;
char* regSubKeyBase = "Software\\PJBSoftware\\ScreenShooter";

bool isRegVersion = false;

filepath = (char*)malloc(100 * sizeof(char));
if (!filepath) return 1;


HKEY progKey;
//Get the screenshot location from the registry, else stuff 'em in "My Documents"
if (RegOpenKeyEx(HKEY_CURRENT_USER,regSubKeyBase,0,KEY_QUERY_VALUE,&progKey) == ERROR_SUCCESS)
{
    DWORD buffsize = 100;
    DWORD type;
    if (RegQueryValueEx(progKey,"ScreenshotPath",NULL,&type,(LPBYTE)filepath,&buffsize) != ERROR_SUCCESS) return 1;
 }
else
{
    char* username = (char*) malloc(25 * sizeof(char));
    if (! username) return 1;
    DWORD buffsize = 25;
    BOOL st = GetUserName(username,&buffsize);
    if (!st) return 1;


    sprintf(filepath,"C:\\Documents and Settings\\%s\\My Documents",username);
    free (username);
}

// Get the time
GetLocalTime((LPSYSTEMTIME)&time);

hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
hdcCompatible = CreateCompatibleDC(hdcScreen);

// Create a compatible bitmap for hdcScreen.

hbmScreen = CreateCompatibleBitmap(hdcScreen,
                     GetDeviceCaps(hdcScreen, HORZRES),
                     GetDeviceCaps(hdcScreen, VERTRES));

if (hbmScreen == 0)
    printf("Could not create bitmap\n");

// Select the bitmaps into the compatible DC.

if (!SelectObject(hdcCompatible, hbmScreen))
    printf("Could not select bitmap\n");



         //Copy color data for the entire display into a
         //bitmap that is selected into a compatible DC.

        if (!BitBlt(hdcCompatible,
               0,0,
               GetDeviceCaps(hdcScreen, HORZRES), GetDeviceCaps(hdcScreen, VERTRES),
               hdcScreen,
               0,0,
               SRCCOPY))

         printf("Screen to Compat Blt Failed\n");

    filename = (char*)malloc(150 * sizeof(char));
    if (!filename) return 1;

    sprintf(filename,"%s\\screenshot-%04u-%02u-%02u-%02u%02u%02u.bmp",filepath,time.wYear,time.wMonth,time.wDay,time.wHour,time.wMinute,time.wSecond);
    free(filepath);


    CreateBMPFile(filename,CreateBitmapInfoStruct(hbmScreen),hbmScreen,hdcCompatible);

    free(filename);

 	return 0;


}
Exemplo n.º 7
0
//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND  - process the application menu
//  WM_PAINT    - Paint the main window
//  WM_DESTROY  - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	PAINTSTRUCT ps;
	HDC hdc = GetDC(hWnd);
	switch (mode)
	{
	case 0:
		FreeDrawProc(hWnd, message, wParam, lParam);
		break;
	case 1:
		DrawLineProc(hWnd, message, wParam, lParam);
	case 2:
		DrawEllipseProc(hWnd, message, wParam, lParam);
	case 3:
		DrawRoundProc(hWnd, message, wParam, lParam);
	case 4:
		DrawSquareProc(hWnd, message, wParam, lParam);
	case 5:
		DrawRectangleProc(hWnd, message, wParam, lParam);
	}
	
	switch (message)
    {
	case WM_CREATE:
	{
		p1.x = p1.y = 0;
		p2 = p1;
		mode = 1;
		enTrainDessin = FALSE;

		//Tạo bitmap
	
		RECT rect;
		GetClientRect(hWnd, &rect);
		//Tạo ra một bitmap tương thích với DC màn hình
		hBitmap = CreateCompatibleBitmap(hdc, rect.right - rect.left, rect.bottom - rect.top);
		
		//Tô background cho bitmap
		//Tạo memory dc để tương tác với Bitmap
		HDC memDC = CreateCompatibleDC(hdc);
		SelectObject(memDC, hBitmap);
		HBRUSH hBrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
		FillRect(memDC, &rect, hBrush);
		DeleteObject(hBrush);
		DeleteDC(memDC);
		ReleaseDC(hWnd, hdc);
		break;
	}
    case WM_COMMAND:
        {
			
            int wmId = LOWORD(wParam);
            // Parse the menu selections:
            switch (wmId)
            {
			case ID_LINE_STRAIGHTLINE:
				mode = 1;
			break;
			case ID_LINE_FREESTYLE:
				mode = 0;
				break;
			
			case ID_SHAPE_ELLIPSE:
				mode = 2;
				break;
			
			case ID_SHAPE_ROUND:
				mode = 3;
				break;
			
			case ID_SHAPE_SQUARE:
				mode = 4;
				break;
			
			case ID_SHAPE_RECTANGLE:
				mode = 5;
				break;

			case ID_DRAW_WIDTH:
				DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG2), hWnd, AboutBox);
				break;

			case ID_COLOR_RED:
				R = 255;
				G = 0;
				B = 0;
					break;

			case ID_COLOR_GREEN:
				R = 0;
				G = 255;
				B = 0;
					break;


			case ID_COLOR_BLUE:
				R = 0;
				G = 0;
				B = 255;
					break;

			case ID_FORMAT_COLOR:
				doChooseColor(hEdit);

				break;
            
			case ID_FILE_OPEN:

				OPENFILENAME ofn;
				TCHAR szFile[260];
				ZeroMemory(&ofn, sizeof(ofn));
				ofn.lStructSize = sizeof(ofn);
				ofn.hwndOwner = hWnd;
				ofn.lpstrFile = szFile;
				ofn.lpstrFile[0] = '\0';
				ofn.nMaxFile = sizeof(szFile);
				ofn.lpstrFilter = _T("All Files *.*\0*.*\0Text Files *.txt\0*.TXT\0 Doc Files\0*.TXT;*.DOC;*.BAK\0");
				ofn.nFilterIndex = 1;
				ofn.lpstrInitialDir = _T("C:\\");
				ofn.lpstrTitle = _T("My Application - Open file");
				ofn.lpstrDefExt = _T("txt");
				ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

				// Display the Open dialog box. 
				if (GetOpenFileName(&ofn) == TRUE) {
					PAINTSTRUCT ps;
					HDC hdc = GetDC(hWnd);
					//			HDC hdcDestination;
					HBITMAP hbitmap = (HBITMAP)::LoadImage(NULL, ofn.lpstrFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
					//	MessageBox(NULL, ofn.lpstrFile, _T("Selected file"), MB_OK);
					//hdc = getOb
					HDC memDC = CreateCompatibleDC(hdc);
					SelectObject(memDC, hbitmap);
					RECT rect;
					GetClientRect(hWnd, &rect);
					BitBlt(hdc, 0, 0, rect.right - rect.left, rect.bottom - rect.top, memDC, 0, 0, SRCCOPY);
				}

				break;
			case ID_FILE_SAVE:
			{
				OPENFILENAME ofn;
				ZeroMemory(&ofn, sizeof(ofn));
				char szFileName[MAX_LOADSTRING];
				ZeroMemory(szFileName, MAX_LOADSTRING);
				ofn.lStructSize = sizeof(ofn);
				ofn.hwndOwner = NULL;
				ofn.lpstrFilter = _T("All Files(*.*)\0 * .*\0Bmp Files(*.bmp)\0 * .bmp\0Text Files(*.txt)\0 * .txt\0");
				ofn.lpstrFile = (LPWSTR)szFileName;
				ofn.nMaxFile = MAX_LOADSTRING;
				ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
				ofn.lpstrDefExt = (LPCWSTR)L"bmp";
				GetSaveFileName(&ofn);
				PBITMAPINFO PBi = CreateBitmapInfoStruct(hWnd, hBitmap);
				CreateBMPFile(hWnd, ofn.lpstrFile, PBi, hBitmap, hdc);
				/*save = 1;*/
			}
				break;
			case ID_FILE_EXIT:
				DestroyWindow(hWnd);
				break;
			default:
				return DefWindowProc(hWnd, message, wParam, lParam);
            }
        }
        break;


    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            
            // TODO: Add any drawing code that uses hdc here...
			HDC hdc = BeginPaint(hWnd, &ps);
			//Vẽ bitmap ra màn hình trước
			HDC memDC = CreateCompatibleDC(hdc);
			SelectObject(memDC, hBitmap);
			RECT rect;
			GetClientRect(hWnd, &rect);
			BitBlt(hdc, 0, 0, rect.right - rect.left, rect.bottom - rect.top, memDC, 0, 0, SRCCOPY);
				switch (mode)
				{
				case 0:
					//Vẽ tự do thì ta vẽ luôn trên màn hình và bitmap
					FreeDraw(memDC);
					FreeDraw(hdc);
					break;
				case 1:
					//Vẽ đường thẳng thì ta chỉ vẽ lên màn hình
					DrawLine(hdc);
					break;
				case 2:
					
					DrawEllipse(hdc);
					break;
				case 3:

					DrawRound(hdc);
					break;
				case 4:

					DrawSquare(hdc);
					break;
				case 5:
					//DrawRectangle(memDC);
					DrawRectangle(hdc);
					break;
				}
				
				DeleteObject(memDC);
			//SelectObject(hdc, oldPen);
			
            EndPaint(hWnd, &ps);
        }
        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}
Exemplo n.º 8
0
void CReplayFrame::CreateReplayFrame(void)
{
	CString			path = "", filename = "", text = "", fcra_seen = "";
	FILE			*fp = NULL;
	int				i = 0;
	time_t			ltime = 0;
	tm				now_time = {0};
	char			now_time_str[100] = {0};
	ULARGE_INTEGER	free_bytes_for_user_on_disk = {0}, 
					total_bytes_on_disk = {0}, 
					free_bytes_total_on_disk = {0};
	int				e = SUCCESS;

	//  Sanity check: Enough disk-space for replay frame?	
	GetDiskFreeSpaceEx(
		_startup_path,				  //  Directory on disk of interest
		&free_bytes_for_user_on_disk,  
		&total_bytes_on_disk,	
		&free_bytes_total_on_disk);
	if (free_bytes_for_user_on_disk.QuadPart < FREE_SPACE_NEEDED_FOR_REPLAYFRAME) 
	{
		MessageBox(NULL, "Not enough disk space to create replay-frame.", 
				"ERROR", 0);	
		return;
	}

	// Get current time
	time(&ltime);
	localtime_s(&now_time, &ltime);
	strftime(now_time_str, 100, "%Y-%m-%d %H:%M:%S", &now_time);

	// Create replay/session dir if it does not exist
	path.Format("%s\\replay\\session_%lu\\", _startup_path, theApp._session_id);
	if (GetFileAttributes(path.GetString()) == INVALID_FILE_ATTRIBUTES)
		SHCreateDirectoryEx(NULL, path.GetString(), NULL);

	// Get exclusive access to CScraper and CSymbols variables
	// (Wait for scrape/symbol cycle to finish before saving frame)
	EnterCriticalSection(&p_heartbeat_thread->cs_update_in_progress);

		// Create bitmap file
		path.Format("%s\\replay\\session_%lu\\frame%03d.bmp", _startup_path, theApp._session_id, _next_replay_frame);
		CreateBMPFile(path.GetString(), p_scraper->entire_window_cur());

		// Create HTML file
		path.Format("%s\\replay\\session_%lu\\frame%03d.htm", _startup_path, theApp._session_id, _next_replay_frame);
		if (fopen_s(&fp, path.GetString(), "w")==0)
		{
			fprintf(fp, p_scraper->title());
			fprintf(fp, "\n");
			fprintf(fp, "<html>\n");
			fprintf(fp, "<style>\n");
			fprintf(fp, "td {text-align:right;}\n");
			fprintf(fp, "</style>\n");
			fprintf(fp, "<body>\n");
			fprintf(fp, "<font face=courier>\n");
			fprintf(fp, "<img src=\"frame%03d.bmp\">\n", _next_replay_frame);
			fprintf(fp, "<br>\n");
			fprintf(fp, "<a href=\"frame%03d.htm\">PREV</a>\n",
					_next_replay_frame-1 >= 0 ? _next_replay_frame-1 : prefs.replay_max_frames());
			fprintf(fp, "<a href=\"frame%03d.htm\">NEXT</a>\n",
					_next_replay_frame+1 < prefs.replay_max_frames() ? _next_replay_frame+1 : 0);
			fprintf(fp, " [%lu.%03d] [%s]<br>\n", theApp._session_id, _next_replay_frame, now_time_str);
			fprintf(fp, "<br>\n");
			fprintf(fp, "<table>\n");
			fprintf(fp, "<tr>\n");
			fprintf(fp, "<td>\n");

			// Table for: SFABD, hand, bet, balance, name
			fprintf(fp, "<table border=4 cellpadding=1 cellspacing=1>\n");
			fprintf(fp, "<tr>\n");
			fprintf(fp, "<th>#</th>\n");
			fprintf(fp, "<th>SFABDP</th>\n");  //seated, friend, active, button, dealt, playing
			fprintf(fp, "<th>hand</th>\n");
			fprintf(fp, "<th>bet</th>\n");
			fprintf(fp, "<th>balance</th>\n");
			fprintf(fp, "<th>name</th>\n");
			fprintf(fp, "</tr>\n");
			for (i=0; i<p_tablemap->s$items()->num_chairs; i++)
			{

				fprintf(fp, "<tr>\n");
				fprintf(fp, "<td>%d</td>", i);  // #
				text.Format("%s%s%s%s%s%s",
					(int) (p_symbols->sym()->playersseatedbits) & (1<<i) ? "s" : "-",
					p_symbols->sym()->userchair == i ? "f" : "-",
					(int) (p_symbols->sym()->playersactivebits) & (1<<i) ? "a" : "-",
					p_symbols->sym()->dealerchair== i ? "b" : "-",
					(int) (p_symbols->sym()->playersdealtbits) & (1<<i) ? "d" : "-",
					(int) (p_symbols->sym()->playersplayingbits) & (1<<i) ? "p" : "-");
				fprintf(fp, "<td>%s</td>", text.GetString());  // SFABDP
				fprintf(fp, "<td>%s%s</td>",
						GetCardHtml(p_scraper->card_player(i, 0)),
						GetCardHtml(p_scraper->card_player(i, 1)) );  // hand
				fprintf(fp, "<td>%11.2f</td>", p_scraper->player_bet(i));  // bet
				fprintf(fp, "<td>%11.2f</td>", p_scraper->player_balance(i));  // balance
				fprintf(fp, "<td>%-15s</td>\n", p_scraper->player_name(i).GetString());  // name
				fprintf(fp, "</tr>\n");
			}
			fprintf(fp, "</table>\n");
			fprintf(fp, "</td>\n");

			// Table for: FCRA
			fprintf(fp, "<td>\n");
			fprintf(fp, "<table align=center border=4 cellpadding=1 cellspacing=1>\n");
			fprintf(fp, "<tr><th>FCRA</th></tr>\n");
			fprintf(fp, "<tr>\n");
			int sym_myturnbits = (int) p_symbols->sym()->myturnbits;
			fcra_seen.Format("%s%s%s%s",
				sym_myturnbits&0x1 ? "F" : ".",
				sym_myturnbits&0x2 ? "C" : ".",
				sym_myturnbits&0x4 ? "R" : ".",
				sym_myturnbits&0x8 ? "A" : ".");

			fprintf(fp, "<td>%s</td>\n", fcra_seen.GetString());
			fprintf(fp, "</tr>\n");
			fprintf(fp, "</table>\n");

			// Table for: sb, bb, BB
			fprintf(fp, "<table align=center border=4 cellpadding=1 cellspacing=1>\n");
			fprintf(fp, "<tr><th>sb</th><td>%11.2f</td></tr>\n", p_symbols->sym()->sblind);
			fprintf(fp, "<tr><th>bb</th><td>%11.2f</td></tr>\n", p_symbols->sym()->bblind);
			fprintf(fp, "<tr><th>BB</th><td>%11.2f</td></tr>\n", p_symbols->bigbet());
			fprintf(fp, "</table>\n");

			// Table for: common cards
			fprintf(fp, "<table align=center border=4 cellpadding=1 cellspacing=1>\n");
			fprintf(fp, "<tr><th>commoncard</th></tr>\n");
			fprintf(fp, "<tr>\n");
			fprintf(fp, "<td>%s%s%s%s%s</td>\n",
					GetCardHtml(p_scraper->card_common(0)),
					GetCardHtml(p_scraper->card_common(1)),
					GetCardHtml(p_scraper->card_common(2)),
					GetCardHtml(p_scraper->card_common(3)),
					GetCardHtml(p_scraper->card_common(4)) );
			fprintf(fp, "</tr>\n");
			fprintf(fp, "</table>\n");

			// Table for: pots
			fprintf(fp, "<table align=center border=4 cellpadding=1 cellspacing=1>\n");
			fprintf(fp, "<tr><th>#</th><th>pot</th></tr>\n");
			fprintf(fp, "<tr>\n");
			fprintf(fp, "<td>0</td><td>%11.2f</td>\n", p_scraper->pot(0));
			fprintf(fp, "</tr>\n");
			for (i=1; i<=9; i++)
			{
				if (p_scraper->pot(i))
				{
					fprintf(fp, "<tr>\n");
					fprintf(fp, "<td>%d</td><td>%11.2f</td>\n", i, p_scraper->pot(i));
					fprintf(fp, "</tr>\n");
				}
				else
				{
					i = 11;
				}
			}
			fprintf(fp, "</table>\n");

			fprintf(fp, "</td>\n");
			fprintf(fp, "</tr>\n");
			fprintf(fp, "</table>\n");
			fprintf(fp, "</body></html>\n");

			fclose(fp);
		}	

	LeaveCriticalSection(&p_heartbeat_thread->cs_update_in_progress);
}