This code make odd colors to png-file.
LodePNG source files can found from:
http://members.gamedev.net/lode/projects/LodePNG/ (http://members.gamedev.net/lode/projects/LodePNG/)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "lodepng.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{
	HDC hDC;
	if ((hDC = GetDC(NULL)) != NULL) {
		HDC hMemDC;
		if ((hMemDC = CreateCompatibleDC(hDC)) != NULL) {
			int x = GetSystemMetrics(SM_CXSCREEN);
			int y = GetSystemMetrics(SM_CYSCREEN);
			//x = 100; y = 100;
			HBITMAP hBmp = CreateCompatibleBitmap(hDC, x, y);
			if (hBmp) {
				HBITMAP hOldBmp = SelectObject(hMemDC, hBmp);
				// from screen to memory
				//BitBlt(hMemDC, 0, 0, x, y, hDC, 0, 0, SRCCOPY);
				//StretchBlt(hMemDC, 0, 0, x, y, hDC, 0, 0, x, y, SRCCOPY);
				StretchBlt(hMemDC, 0, y, x, -y, hDC, 0, 0, x, y, SRCCOPY);
				//
				BITMAPINFO bmi;
				memset(&bmi, 0, sizeof(BITMAPINFO));
				bmi.bmiHeader.biSize = sizeof(BITMAPINFO);
				DWORD nSize;
				GetDIBits(hDC, hBmp, 0, 0, NULL, &bmi, DIB_RGB_COLORS);
				BYTE *pBuf, *pImg;
				pImg = GlobalAlloc(GPTR, bmi.bmiHeader.biSizeImage);
				if (GetDIBits(hDC, hBmp, 0, bmi.bmiHeader.biHeight, pImg, &bmi, DIB_RGB_COLORS))
				{
					LodePNG_Encoder encoder;
					/*create encoder and set settings and info (optional) */
					LodePNG_Encoder_init(&encoder);
					//encoder.settings.zlibsettings.windowSize = 2048;
					encoder.settings.zlibsettings.windowSize = 4096;
					//LodePNG_Text_add(&encoder.infoPng.text, "Comment", "Created with LodePNG");
					/*encode and save */
					LodePNG_encode(&encoder, &pBuf, &nSize, pImg, bmi.bmiHeader.biWidth, bmi.bmiHeader.biHeight);
					LodePNG_saveFile(pBuf, nSize, "test1.png");
					/*cleanup */
					LodePNG_Encoder_cleanup(&encoder);
				}
				if (pImg)
					GlobalFree(pImg);
				DeleteObject(hBmp);
				DeleteObject(hOldBmp);
			}
			DeleteDC(hMemDC);
		}
		ReleaseDC(NULL, hDC);
	}
	return 0;
}
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "lodepng.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{
	HDC hDC;
	if ((hDC = GetDC(NULL)) != NULL) {
		HDC hMemDC;
		if ((hMemDC = CreateCompatibleDC(hDC)) != NULL) {
			int x = GetSystemMetrics(SM_CXSCREEN);
			int y = GetSystemMetrics(SM_CYSCREEN);
			HBITMAP hBmp = CreateCompatibleBitmap(hDC, x, y);
			if (hBmp) {
				HBITMAP hOldBmp = SelectObject(hMemDC, hBmp);
				// from screen to memory
				StretchBlt(hMemDC, 0, y, x, -y, hDC, 0, 0, x, y, SRCCOPY);
				//
				BITMAPINFO bmi;
				memset(&bmi, 0, sizeof(BITMAPINFO));
				bmi.bmiHeader.biSize = sizeof(BITMAPINFO);
				DWORD nSize;
				GetDIBits(hDC, hBmp, 0, 0, NULL, &bmi, DIB_RGB_COLORS);
				BYTE *pBuf, *pImg;
				pImg = GlobalAlloc(GPTR, bmi.bmiHeader.biSizeImage);
				if (GetDIBits(hDC, hBmp, 0, bmi.bmiHeader.biHeight, pImg, &bmi, DIB_RGB_COLORS))
					LodePNG_encode32f("test1.png", pImg, bmi.bmiHeader.biWidth, bmi.bmiHeader.biHeight);
				if (pImg)
					GlobalFree(pImg);
				DeleteObject(hBmp);
				DeleteObject(hOldBmp);
			}
			DeleteDC(hMemDC);
		}
		ReleaseDC(NULL, hDC);
	}
	return 0;
}