Click here to Skip to main content
15,885,757 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Play Media File Pin
john563231-Jan-13 17:09
john563231-Jan-13 17:09 
GeneralRe: Play Media File Pin
jeron11-Feb-13 7:27
jeron11-Feb-13 7:27 
GeneralRe: Play Media File Pin
merano1-Feb-13 14:11
merano1-Feb-13 14:11 
QuestionTCP Server: Render the image on server side Pin
Sachin k Rajput 30-Jan-13 1:29
Sachin k Rajput 30-Jan-13 1:29 
AnswerRe: TCP Server: Render the image on server side Pin
Richard MacCutchan30-Jan-13 3:01
mveRichard MacCutchan30-Jan-13 3:01 
GeneralRe: TCP Server: Render the image on server side Pin
Sachin k Rajput 30-Jan-13 16:44
Sachin k Rajput 30-Jan-13 16:44 
GeneralRe: TCP Server: Render the image on server side Pin
Richard MacCutchan30-Jan-13 21:52
mveRichard MacCutchan30-Jan-13 21:52 
GeneralRe: TCP Server: Render the image on server side Pin
Sachin k Rajput 30-Jan-13 22:53
Sachin k Rajput 30-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 Pin
Richard MacCutchan30-Jan-13 22:56
mveRichard MacCutchan30-Jan-13 22:56 
GeneralRe: TCP Server: Render the image on server side Pin
Sachin k Rajput 30-Jan-13 22:59
Sachin k Rajput 30-Jan-13 22:59 
GeneralRe: TCP Server: Render the image on server side Pin
Richard MacCutchan30-Jan-13 23:08
mveRichard MacCutchan30-Jan-13 23:08 
AnswerRe: TCP Server: Render the image on server side Pin
Erudite_Eric30-Jan-13 3:13
Erudite_Eric30-Jan-13 3:13 
GeneralRe: TCP Server: Render the image on server side Pin
Richard MacCutchan30-Jan-13 4:35
mveRichard MacCutchan30-Jan-13 4:35 
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 

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.