#include //Custom header that includes windows, opengl, and glu
#include 
#include 
#include 

const char g_szClassName[] = "Rampage";
WNDCLASSEX wc;
HWND hwnd;//handle of the window
MSG msg;
HDC hDc;
HGLRC hRc;
RECT WinRect;
GLuint PixelFormat;
bool done = FALSE;//value to keep message loop running
bool keys[256];//Array to hold keyboard characters
const int ID_FRAMECOUNT = 1;//Timer set to one second, used to count the frames
HINSTANCE hInstance;//Holds the instance of the window
int frame;//Counts how many frames have been displayed
int width, height;
GLfloat rtri;
GLfloat rquad;


///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
////////////////////////The drawing sequence///////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
GLvoid Draw(GLvoid)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();
	glTranslatef(0.0f, 0.0f, -5.0f);
	glBegin(GL_LINES);
	    glVertex3f(1.0f, 0.0f, 0.0f);
	    glVertex3f(-1.0f, 0.0f, 0.0f);
    glEnd();
	frame++;
}

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
///////////////////////This is the resize function//////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

GLvoid ReSizeGLScene(GLsizei width, GLsizei height)
{
	if (height==0)
	{
		height=1;
	}

	glViewport(0,0,width,height);

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();

	gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////Initialise Rampage stuff////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

void InitRamp(void)
{
     static	PIXELFORMATDESCRIPTOR pfd=
	 {
		sizeof(PIXELFORMATDESCRIPTOR),
		1,
		PFD_DRAW_TO_WINDOW |
		PFD_SUPPORT_OPENGL |
		PFD_DOUBLEBUFFER,
		PFD_TYPE_RGBA,
		8,
		0, 0, 0, 0, 0, 0,
		0,
		0,
		0,
		0, 0, 0, 0,
		16, 0, 0, PFD_MAIN_PLANE,
		0, 0, 0, 0
     };
     hDc = GetDC(hwnd);
     PixelFormat=ChoosePixelFormat(hDc,&pfd);
     SetPixelFormat(hDc,PixelFormat,&pfd);
     hRc=wglCreateContext(hDc);
     wglMakeCurrent(hDc,hRc);
     glViewport(0, 0, WinRect.right, WinRect.bottom);
     glShadeModel(GL_SMOOTH);
     glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
     glClearDepth(1.0f);
     glEnable(GL_DEPTH_TEST);
     glDepthFunc(GL_LEQUAL);
     glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

void ShutDownGL(void)
{
     wglMakeCurrent(NULL,NULL);
     wglDeleteContext(hRc);
     hRc=NULL;
     ReleaseDC(hwnd,hDc);
     hDc = NULL;
     DestroyWindow(hwnd);
     hwnd = NULL;
     UnregisterClass("Rampage",hInstance);
     hInstance = NULL;
}

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////This is where the messages get handled////////////////////////
//////////////////Its a pretty cool part, not like window///////////////////////
//////////////////creation and that sort of stuff which ////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
        case WM_TIMER:
             switch(wParam)
             {
             case ID_FRAMECOUNT:
             {
                  char Title[16];
                  sprintf( Title, "%d FPS", frame, NULL);
                  SetWindowText(hwnd, Title);
                  frame = 0;
             }
             break;
        }
        break;
        case WM_KEYDOWN:
             keys[wParam] = true;
        break;
        case WM_KEYUP:
             keys[wParam] = false;
        break;
        case WM_SIZE:
             ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));
        break;
        case WM_CLOSE:
            ShutDownGL();
        break;
        case WM_DESTROY:
            PostQuitMessage(0);
        break;
        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    return 0;
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////This is where all the window creation and messages go. Its a bit////////
///////////////          dodgy cause i hate windows        ////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
{
    HWND DeskHwnd;
    HDC hDesktop;
    
    hInstance = GetModuleHandle(NULL);
    
    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
    wc.lpfnWndProc   = WndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = NULL;
    wc.lpszMenuName  = NULL;
    wc.lpszClassName = g_szClassName;
    wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

    if(!RegisterClassEx(&wc))
    {
        MessageBox(NULL, "Window Registration Failed!", "Error!",
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }

    DeskHwnd = GetDesktopWindow();
    hDesktop = GetDC(DeskHwnd);
    
    width = GetDeviceCaps(hDesktop, HORZRES);
    height = GetDeviceCaps(hDesktop, VERTRES);
    
    ReSizeGLScene(height , width);
    
    ReleaseDC(DeskHwnd, hDesktop);

    hwnd = CreateWindowEx(
        WS_EX_CLIENTEDGE,
        g_szClassName,
        "Base",
        WS_POPUP,
        -3, -3, width + 6, height + 6,
        NULL, NULL, hInstance, NULL);

    if(hwnd == NULL)
    {
        MessageBox(NULL, "Window Creation Failed!", "Error!",
            MB_ICONEXCLAMATION | MB_OK);
        return 0;
    }
    
    InitRamp();
    SetTimer(hwnd, ID_FRAMECOUNT, 1000, NULL);
    ShowWindow(hwnd, nCmdShow);
    
    
///////////////////////////////////////////////////////////////////////////////
////////////////////////This is the dreaded message loop///////////////////////
///////////////////////////////////////////////////////////////////////////////
    
    
    while(!done)
	{
		if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
		{
			if (msg.message==WM_QUIT)
			{
				done=TRUE;
			}
			else
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
		else
		{
            Draw();
            SwapBuffers(hDc);
        }
	}

	ShutDownGL();
	return (msg.wParam);
}

    Source: geocities.com/samuel_super_camel