diploma/diploma.cpp
//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
InitInstance(HINSTANCE, int)
PURPOSE: Saves instance handle and creates main window



In this function, we save the instance handle in a global variable and
create and display the main program window.
InitInstance ( HINSTANCE int ) PURPOSE : Saves instance handle and creates main window In this function we save the instance handle in a global variable and create and display the main program window .
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
	HWND hWnd;
	hInst = hInstance; 
	hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX ,
	   CW_USEDEFAULT, 0, SCRWIDTH, SCRHEIGHT, NULL, NULL, hInstance, NULL);
	if (!hWnd)
	{
	   return FALSE;
	}
	hdc = GetDC(hWnd);	
	canv = new raytracer::CanvasData(SCRWIDTH,SCRHEIGHT);
	canv->Clear(0);
	imgpixels = canv->pixels;
	for ( int cc = 0; cc < sizeof( BITMAPINFOHEADER ) + 16; cc++ ) bitmapbuffer[cc] = 0;
	bh = (BITMAPINFO *)&bitmapbuffer;
	bh->bmiHeader.biSize = sizeof( BITMAPINFOHEADER );
	bh->bmiHeader.biPlanes = 1;
	bh->bmiHeader.biBitCount = 32;
	bh->bmiHeader.biCompression = BI_BITFIELDS;
	bh->bmiHeader.biWidth = SCRWIDTH, bh->bmiHeader.biHeight = -SCRHEIGHT;
	((unsigned long*)bh->bmiColors)[0] = 255 << 16;
	((unsigned long*)bh->bmiColors)[1] = 255 << 8;
	((unsigned long*)bh->bmiColors)[2] = 255;
	ShowWindow(hWnd, nCmdShow);
	UpdateWindow(hWnd);
	return TRUE;
}
BOOL InitInstance ( HINSTANCE hInstance , int nCmdShow ) { HWND hWnd ; hInst = hInstance ; hWnd = CreateWindow ( szWindowClass , szTitle , WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX , CW_USEDEFAULT , 0 , SCRWIDTH , SCRHEIGHT , NULL , NULL , hInstance , NULL ) ; if ( ! hWnd ) { return FALSE ; } hdc = GetDC ( hWnd ) ; canv = new raytracer :: CanvasData ( SCRWIDTH , SCRHEIGHT ) ; canv -> Clear ( 0 ) ; imgpixels = canv -> pixels ; for ( int cc = 0 ; cc < sizeof ( BITMAPINFOHEADER ) + 16 ; cc ++ ) bitmapbuffer [ cc ] = 0 ; bh = ( BITMAPINFO * ) & bitmapbuffer ; bh -> bmiHeader . biSize = sizeof ( BITMAPINFOHEADER ) ; bh -> bmiHeader . biPlanes = 1 ; bh -> bmiHeader . biBitCount = 32 ; bh -> bmiHeader . biCompression = BI_BITFIELDS ; bh -> bmiHeader . biWidth = SCRWIDTH , bh -> bmiHeader . biHeight = - SCRHEIGHT ; ( ( unsigned long * ) bh -> bmiColors ) [ 0 ] = 255 << 16 ; ( ( unsigned long * ) bh -> bmiColors ) [ 1 ] = 255 << 8 ; ( ( unsigned long * ) bh -> bmiColors ) [ 2 ] = 255 ; ShowWindow ( hWnd , nCmdShow ) ; UpdateWindow ( hWnd ) ; return TRUE ; }
FUNCTION: InitInstance(HINSTANCE, int)
PURPOSE: Saves instance handle and creates main window
FUNCTION : InitInstance ( HINSTANCE int ) PURPOSE : Saves instance handle and creates main window
// Store instance handle in our global variable /*    hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);*/ // Original! // ====================== // Preparations code // Drawing Context // Some dark magic related to bitmap conversion/drawing. Taken from Jacco Bikker example // ======================