Code:
void to_clipboard(char *content)
{
 
   int len=str_len(content)*sizeof(char);
   if(len==0) return;//data was empty
	
	if(OpenClipboard(hWnd))//open the clipboard
	{
		if(EmptyClipboard())//emptied?
		{ 
			HANDLE mem=GlobalAlloc(GMEM_MOVEABLE,len+1);//alloc mem
			if(mem)//non zero ?
			{		
				char* temp=GlobalLock(mem);
				memcpy(temp,content,len);
				GlobalUnlock(mem);		
				SetClipboardData(CF_OEMTEXT,mem);
			}
		}
		CloseClipboard();
	}
}



this follows the msdn example in flow , better ?


Compulsive compiler