Click here to Skip to main content
       

C / C++ / MFC

 
GeneralRe: Play Media File Pinmemberjohn563231-Jan-13 17:09 
GeneralRe: Play Media File Pinmemberjeron11-Feb-13 7:27 
GeneralRe: Play Media File Pinmembermerano1-Feb-13 14:11 
QuestionTCP Server: Render the image on server side Pinmembertoms from newdelhi30-Jan-13 1:29 
AnswerRe: TCP Server: Render the image on server side PinmvpRichard MacCutchan30-Jan-13 3:01 
GeneralRe: TCP Server: Render the image on server side Pinmembertoms from newdelhi30-Jan-13 16:44 
GeneralRe: TCP Server: Render the image on server side PinmvpRichard MacCutchan30-Jan-13 21:52 
GeneralRe: TCP Server: Render the image on server side Pinmembertoms from newdelhi30-Jan-13 22:53 
I did tried with this one...
 
case WM_SOCKET:
		{
			int i=256;
			BYTE* data = new BYTE[256*256*256];
  int packetsize, num;
  int newWidth, newHeight;
  int recvimgsize=0;
 
   bool bAwaitingImage = false;
			switch(WSAGETSELECTEVENT(lParam))
			{
				case FD_READ:
				{
	
					  num=recv(Socket, (char*)data, 3, 0);
				
				if(num>0)
      {
 
		 
        packetsize = data[1]*256+ data[2];
 
        num=recv(Socket, (char*)(data+3), packetsize-3, 0);
     
				}
				 if(num>0)
				 {
				 switch(data[0])
				 {
				  case 2: //received information about window size (image size)

					 
            newWidth = data[3]*256+data[4];
            newHeight = data[5]*256+data[6];
					   		 
				 
			if(newHeight!=cBitmap.bmHeight || newWidth!=cBitmap.bmWidth)
            {
				cBitmap.bmWidth = newWidth;
				cBitmap.bmHeight = newHeight;
 
              RECT r;
 
			   GetWindowRect(hWnd, &r);
			   SetWindowPos(hWnd, NULL, r.left, r.top, cBitmap.bmWidth, cBitmap.bmHeight, 0);
 

			   HDC ThisDC = GetDC(hWnd);
 
              DeleteDC(RemoteDC);
              RemoteDC = CreateCompatibleDC(ThisDC);
 
              DeleteObject(hbitmap);
			  hbitmap = CreateCompatibleBitmap(ThisDC,cBitmap.bmWidth ,cBitmap.bmHeight);
 
              SelectObject(RemoteDC, hbitmap);
 
              ReleaseDC(hWnd, ThisDC);
 
				 }
				 break;
				 
 
				  case 3:
          {
            BITMAPINFO bi;
           
            int biSize = sizeof(BITMAPINFO);
            memcpy(&bi, data+3, biSize);
			SetDIBits(RemoteDC, hbitmap, 0,cBitmap.bmHeight, data+biSize+3, &bi, DIB_RGB_COLORS);
 
            InvalidateRect(hWnd, NULL, false);
 
            break;
          }
 
 

its a long code ,,,
but i got stuck on when client sends image then it is completely sent but from server side program hangs and stopped working and nothing on server.
 
I'll be highly thankful if you can help me in this!!
Thanks
GeneralRe: TCP Server: Render the image on server side PinmvpRichard MacCutchan30-Jan-13 22:56 
GeneralRe: TCP Server: Render the image on server side Pinmembertoms from newdelhi30-Jan-13 22:59 
GeneralRe: TCP Server: Render the image on server side PinmvpRichard MacCutchan30-Jan-13 23:08 
AnswerRe: TCP Server: Render the image on server side PinmemberErudite_Eric30-Jan-13 3:13 
GeneralRe: TCP Server: Render the image on server side PinmvpRichard MacCutchan30-Jan-13 4:35 
GeneralRe: TCP Server: Render the image on server side PinmemberErudite_Eric30-Jan-13 5:01 
GeneralRe: TCP Server: Render the image on server side Pinmembertoms from newdelhi30-Jan-13 16:47 
GeneralRe: TCP Server: Render the image on server side PinmemberErudite_Eric30-Jan-13 22:36 
GeneralRe: TCP Server: Render the image on server side Pinmembertoms from newdelhi30-Jan-13 22:57 
GeneralRe: TCP Server: Render the image on server side PinmemberErudite_Eric31-Jan-13 21:35 
AnswerRe: TCP Server: Render the image on server side PinmemberAndy Bantly30-Jan-13 12:12 
GeneralRe: TCP Server: Render the image on server side Pinmembertoms from newdelhi30-Jan-13 16:51 
GeneralRe: TCP Server: Render the image on server side PinmemberAndy Bantly3-Feb-13 3:58 
QuestionCan a modeless dialog box be a main window PinmemberForNow29-Jan-13 11:44 
AnswerRe: Can a modeless dialog box be a main window Pinmember«_Superman_»29-Jan-13 19:17 
GeneralRe: Can a modeless dialog box be a main window PinmemberForNow29-Jan-13 19:34 
AnswerRe: Can a modeless dialog box be a main window PinmvpRichard MacCutchan29-Jan-13 21:10 

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

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


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 1 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid