Hello guys, I'm new to C++ and I couldn't figure out the proper way to store pixel data of a device context into an array using GetDIBits(). Currently I am trying to get the RGB values of a single pixel of a bitmap file:

Code:
#include <windows.h>
#include <iostream>
using namespace std;
int main() {HDC MemDC=CreateCompatibleDC(NULL);
	SelectObject(MemDC,(HBITMAP)LoadImage(NULL,(LPCTSTR)"F:\\gBit.bmp",IMAGE_BITMAP,1366,768,LR_LOADFROMFILE));
	HBITMAP hBit=(HBITMAP)LoadImage(NULL,(LPCTSTR)"F:\\gBit.bmp",IMAGE_BITMAP,1366,768,LR_LOADFROMFILE);
	BITMAPINFO bmi;
	BYTE p[3];


	bmi.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
	bmi.bmiHeader.biWidth=1;
	bmi.bmiHeader.biHeight=-1;
	bmi.bmiHeader.biPlanes=1;
	bmi.bmiHeader.biBitCount=24;
	bmi.bmiHeader.biCompression=BI_RGB;
	bmi.bmiHeader.biSizeImage=0;
	bmi.bmiHeader.biXPelsPerMeter=0;
	bmi.bmiHeader.biYPelsPerMeter=0;
	bmi.bmiHeader.biClrUsed=0;
	bmi.bmiHeader.biClrImportant=0;


	GetDIBits(MemDC,hBit,0,0,p,&bmi,DIB_RGB_COLORS);
	cout<<p[0]<<endl<<p[1]<<endl<<p[2];
	ReleaseDC(NULL,MemDC); DeleteDC(MemDC);
	DeleteObject(hBit); while (1) {}
}
gBit.bmp, the bitmap file selected into MemDC, is an entirely white 24-bit bitmap image, so I thought cout should display 255, but for some reason it displays some weird characters. Most probably p is not initialized since the same values are returned when I remove the line containing GetDIBits(). Am I using this function properly? What could I possibly be doing wrong here?