Click here to Skip to main content
15,904,986 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Bitmap creation from a buffer recived Pin
Sachin k Rajput 1-Feb-13 1:46
Sachin k Rajput 1-Feb-13 1:46 
GeneralRe: Bitmap creation from a buffer recived Pin
Richard MacCutchan1-Feb-13 2:35
mveRichard MacCutchan1-Feb-13 2:35 
GeneralRe: Bitmap creation from a buffer recived Pin
Jibesh1-Feb-13 8:03
professionalJibesh1-Feb-13 8:03 
QuestionMFC and printing Pin
Argonia31-Jan-13 5:43
professionalArgonia31-Jan-13 5:43 
AnswerRe: MFC and printing Pin
SujayG1-Feb-13 16:21
SujayG1-Feb-13 16:21 
QuestionMFC Smart Device App with Visual C++ in Visual Std 2008 Pin
sefaonline31-Jan-13 3:09
sefaonline31-Jan-13 3:09 
AnswerRe: MFC Smart Device App with Visual C++ in Visual Std 2008 Pin
Richard MacCutchan31-Jan-13 3:45
mveRichard MacCutchan31-Jan-13 3:45 
Questionunable to register COM dll 64 bit Pin
john563231-Jan-13 2:12
john563231-Jan-13 2:12 
AnswerRe: unable to register COM dll 64 bit Pin
«_Superman_»1-Feb-13 16:59
professional«_Superman_»1-Feb-13 16:59 
QuestionPlay Media File Pin
john563230-Jan-13 19:38
john563230-Jan-13 19:38 
AnswerRe: Play Media File Pin
_Flaviu30-Jan-13 21:47
_Flaviu30-Jan-13 21:47 
GeneralRe: Play Media File Pin
john563231-Jan-13 1:07
john563231-Jan-13 1:07 
AnswerRe: Play Media File Pin
jeron131-Jan-13 4:28
jeron131-Jan-13 4:28 
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 

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.