Click here to Skip to main content
15,887,945 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: TCP Server: Render the image on server side Pin
Erudite_Eric30-Jan-13 5:01
Erudite_Eric30-Jan-13 5:01 
GeneralRe: TCP Server: Render the image on server side Pin
Sachin k Rajput 30-Jan-13 16:47
Sachin k Rajput 30-Jan-13 16:47 
GeneralRe: TCP Server: Render the image on server side Pin
Erudite_Eric30-Jan-13 22:36
Erudite_Eric30-Jan-13 22:36 
GeneralRe: TCP Server: Render the image on server side Pin
Sachin k Rajput 30-Jan-13 22:57
Sachin k Rajput 30-Jan-13 22:57 
GeneralRe: TCP Server: Render the image on server side Pin
Erudite_Eric31-Jan-13 21:35
Erudite_Eric31-Jan-13 21:35 
AnswerRe: TCP Server: Render the image on server side Pin
Andy Bantly30-Jan-13 12:12
Andy Bantly30-Jan-13 12:12 
GeneralRe: TCP Server: Render the image on server side Pin
Sachin k Rajput 30-Jan-13 16:51
Sachin k Rajput 30-Jan-13 16:51 
GeneralRe: TCP Server: Render the image on server side Pin
Andy Bantly3-Feb-13 3:58
Andy Bantly3-Feb-13 3:58 
QuestionCan a modeless dialog box be a main window Pin
ForNow29-Jan-13 11:44
ForNow29-Jan-13 11:44 
AnswerRe: Can a modeless dialog box be a main window Pin
«_Superman_»29-Jan-13 19:17
professional«_Superman_»29-Jan-13 19:17 
GeneralRe: Can a modeless dialog box be a main window Pin
ForNow29-Jan-13 19:34
ForNow29-Jan-13 19:34 
AnswerRe: Can a modeless dialog box be a main window Pin
Richard MacCutchan29-Jan-13 21:10
mveRichard MacCutchan29-Jan-13 21:10 
GeneralRe: Can a modeless dialog box be a main window Pin
ForNow30-Jan-13 7:30
ForNow30-Jan-13 7:30 
GeneralRe: Can a modeless dialog box be a main window Pin
Richard MacCutchan30-Jan-13 7:34
mveRichard MacCutchan30-Jan-13 7:34 
GeneralRe: Can a modeless dialog box be a main window Pin
ForNow30-Jan-13 8:13
ForNow30-Jan-13 8:13 
GeneralRe: Can a modeless dialog box be a main window Pin
Richard MacCutchan30-Jan-13 9:07
mveRichard MacCutchan30-Jan-13 9:07 
AnswerRe: Can a modeless dialog box be a main window Pin
Erudite_Eric30-Jan-13 3:04
Erudite_Eric30-Jan-13 3:04 
GeneralRe: Can a modeless dialog box be a main window Pin
ForNow30-Jan-13 7:31
ForNow30-Jan-13 7:31 
QuestionAnyone heard of an Anonymous Statistics / User Experience API or Toolkit Pin
Blake Miller29-Jan-13 6:11
Blake Miller29-Jan-13 6:11 
QuestionHow to load a png image in PictureControl? Pin
VCProgrammer29-Jan-13 1:41
VCProgrammer29-Jan-13 1:41 
QuestionRe: How to load a png image in PictureControl? Pin
Richard MacCutchan29-Jan-13 3:33
mveRichard MacCutchan29-Jan-13 3:33 
AnswerRe: How to load a png image in PictureControl? Pin
yu-jian29-Jan-13 15:40
yu-jian29-Jan-13 15:40 
GeneralRe: How to load a png image in PictureControl? Pin
VCProgrammer30-Jan-13 22:19
VCProgrammer30-Jan-13 22:19 
GeneralRe: How to load a png image in PictureControl? Pin
yu-jian1-Feb-13 4:04
yu-jian1-Feb-13 4:04 
GeneralRe: How to load a png image in PictureControl? Pin
VCProgrammer4-Feb-13 1:24
VCProgrammer4-Feb-13 1:24 
LPCTSTR szResourceName =MAKEINTRESOURCE(IDB_PNG1);
	LPCTSTR szResourceType=_T("PNG");
	HMODULE hresModule=AfxGetResourceHandle(); 

	HRSRC hPicture = FindResource(hresModule,szResourceName,szResourceType);
	HGLOBAL hResData;

	// Load the dialog box into global memory.
	if (!hPicture || !(hResData = LoadResource(hresModule,hPicture)))
	{
		TRACE(_T("Load (resource): Error loading resource %s\n"),szResourceName);
		return ;
	};
	DWORD dwSize = SizeofResource(hresModule,hPicture);	

	// hResData is not the real HGLOBAL (we can't lock it)
	// let's make it real

	HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_NODISCARD,dwSize);
	if (!hGlobal)
	{
		TRACE(_T("Load (resource): Error allocating memory\n"));
		FreeResource(hResData);
		return ;
	};
	
	char *pDest = reinterpret_cast<char *> (GlobalLock(hGlobal));
	char *pSrc = reinterpret_cast<char *> (LockResource(hResData));
	if (!pSrc || !pDest)
	{
		TRACE(_T("Load (resource): Error locking memory\n"));
		GlobalFree(hGlobal);
		FreeResource(hResData);
		return  ;
	};

	//IStream* pStream;
	ULONG ulWritten=0;
	ulWritten = 0;

	CopyMemory(pDest,pSrc,dwSize);

	HRESULT hr = ::CreateStreamOnHGlobal(hGlobal,FALSE,&pStream);
	pStream->Write(pDest, dwSize, &ulWritten);

	FreeResource(hResData);
	GlobalUnlock(hGlobal);

	Bitmap oBmp(pStream,0);

  	m_Image_ics.Load(pStream);
	HDC memdc;
	CRect rect;
	this->GetClientRect(&rect);     
	//=====
	HBITMAP hBmp;
	oBmp.GetHBITMAP(0, &hBmp);
	::SendMessage(png_bnr->GetSafeHwnd(),STM_SETIMAGE,IMAGE_BITMAP,(LPARAM)hBmp);

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.