bmi comes from
Code:
	BITMAPINFO* bmi;
	if ( OpenClipboard() ) 
	{
		HGLOBAL hglb = NULL;
		if ((hglb = GetClipboardData(CF_DIB))) 
		{
			switch (format) {
				case CF_DIB:	
				{
					bmi = (BITMAPINFO*) GlobalLock(hglb);
...
And the clipboard is definitely containing a picture in CF_DIB format (I checked using some clipboard program I found in an article on codeguru; I also get into the right case in the switch statement).