Click here to Skip to main content
15,919,132 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Login Dialog Probelm Pin
MsmVc9-Dec-08 17:35
MsmVc9-Dec-08 17:35 
QuestionReg : inheritance Pin
pooja_friends5-Dec-08 1:19
pooja_friends5-Dec-08 1:19 
AnswerRe: Reg : inheritance Pin
Code-o-mat5-Dec-08 1:29
Code-o-mat5-Dec-08 1:29 
GeneralRe: Reg : inheritance Pin
pooja_friends5-Dec-08 2:00
pooja_friends5-Dec-08 2:00 
GeneralRe: Reg : inheritance Pin
Code-o-mat5-Dec-08 2:09
Code-o-mat5-Dec-08 2:09 
AnswerRe: Reg : inheritance Pin
CPallini5-Dec-08 2:01
mveCPallini5-Dec-08 2:01 
QuestionControlling Display Device Pin
Muneeb Abdul Shakoor5-Dec-08 1:01
Muneeb Abdul Shakoor5-Dec-08 1:01 
AnswerRe: Controlling Display Device Pin
Mark Salsbery5-Dec-08 4:53
Mark Salsbery5-Dec-08 4:53 
QuestionPlease help me with my decryption it almost works Pin
monsieur_jj4-Dec-08 23:23
monsieur_jj4-Dec-08 23:23 
AnswerRe: Please help me with my decryption it almost works Pin
CPallini5-Dec-08 11:08
mveCPallini5-Dec-08 11:08 
GeneralRe: Please help me with my decryption it almost works Pin
monsieur_jj5-Dec-08 14:47
monsieur_jj5-Dec-08 14:47 
GeneralRe: Please help me with my decryption it almost works Pin
Luc Pattyn5-Dec-08 11:47
sitebuilderLuc Pattyn5-Dec-08 11:47 
AnswerRe: Please help me with my decryption it almost works Pin
Randor 5-Dec-08 21:10
professional Randor 5-Dec-08 21:10 
GeneralRe: Please help me with my decryption it almost works Pin
monsieur_jj7-Dec-08 19:08
monsieur_jj7-Dec-08 19:08 
QuestionStatic problem Pin
NewVC++4-Dec-08 22:21
NewVC++4-Dec-08 22:21 
AnswerRe: Static problem Pin
Iain Clarke, Warrior Programmer4-Dec-08 22:27
Iain Clarke, Warrior Programmer4-Dec-08 22:27 
AnswerRe: Static problem Pin
Jijo.Raj5-Dec-08 3:17
Jijo.Raj5-Dec-08 3:17 
AnswerRe: Static problem Pin
Hamid_RT5-Dec-08 6:33
Hamid_RT5-Dec-08 6:33 
Questionhow to find if the file is transferred [modified] Pin
Dhiraj kumar Saini4-Dec-08 22:05
Dhiraj kumar Saini4-Dec-08 22:05 
Hello ,

I am sending a gif file to the HTTP Server.
Is there any way to find that the file is transfered successfully.
If yes how?

INTERNET_BUFFERS BufferIn = {0};
	DWORD dwBytesRead;
	DWORD dwBytesWritten;
	BYTE pBuffer[1024]; // Read from file in 1K chunks
	BOOL bRead, bRet;
	HANDLE hFile;




	HINTERNET hSession = InternetOpen(NULL,
                                      INTERNET_OPEN_TYPE_PRECONFIG,
                                      NULL,
                                      NULL,
                                      0);
    HINTERNET hConnection = InternetConnect(hSession, 
                                            _T("www.crmpanel.com"),  // Server
                                            INTERNET_DEFAULT_HTTP_PORT,
                                            NULL,     // Username
                                            NULL,     // Password
                                            INTERNET_SERVICE_HTTP,
                                            0,        // Synchronous
                                            NULL);    // No Context


	

     BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS );

     HINTERNET hRequest = HttpOpenRequest(hConnection,
											_T("PUT"),
											_T("/temp"),
											NULL,
											NULL,
											NULL,
											0,
											0);
     if (!hRequest)
     {
       //printf("Failed to open request handle: %lu\n", GetLastError ());
		 MessageBox(_T("Failed to open request handle:"),NULL,MB_OK);
       return ;
     }



	 hFile = CreateFile (_T("c:\\Image1.gif"),
						GENERIC_READ,
						FILE_SHARE_READ,
						NULL,
						OPEN_EXISTING,
						FILE_ATTRIBUTE_NORMAL,
						NULL);

     if (hFile == INVALID_HANDLE_VALUE)
     {
      	    MessageBox(_T("Failed to open local file"),NULL,MB_OK);
       return ;
     }



     BufferIn.dwBufferTotal = GetFileSize(hFile, NULL);
	 MessageBox(_T("File size is"),NULL,MB_OK);
    
     if(!HttpSendRequestEx(hRequest, &BufferIn, NULL, HSR_INITIATE, 0))
     {
		 MessageBox(_T("Error on HttpSendRequestEx"),NULL,MB_OK);
				       return ;
     }


     DWORD sum = 0;
     do
     {
       if  (!(bRead = ReadFile (hFile, pBuffer, sizeof(pBuffer),
           &dwBytesRead, NULL)))
       {
		 MessageBox(_T("ReadFile failed on buffer"),NULL,MB_OK);
                 break;
       }
       if (!(bRet=InternetWriteFile( hRequest, pBuffer, dwBytesRead,
           &dwBytesWritten)))
       {
		 MessageBox(_T("InternetWriteFile failed"),NULL,MB_OK);
                  break;
       }
       sum += dwBytesWritten;
     }
     while (dwBytesRead == sizeof(pBuffer)) ;

     CloseHandle (hFile);
	 MessageBox(_T("Actual written bytes:"),NULL,MB_OK);
     
     if(!HttpEndRequest(hRequest, NULL, 0, 0))
     {
	   MessageBox(_T("Error on HttpEndRequest"),NULL,MB_OK);
             return ;
     }

	 
	 
	 return ;


Please help me.

Thanks In Advance

modified on Friday, December 5, 2008 5:52 AM

QuestionRe: how to find if the file is transferred Pin
David Crow5-Dec-08 3:01
David Crow5-Dec-08 3:01 
QuestionWalk through html controls Pin
Varghese Paul M4-Dec-08 21:28
Varghese Paul M4-Dec-08 21:28 
AnswerRe: Walk through html controls Pin
Rajesh R Subramanian4-Dec-08 21:46
professionalRajesh R Subramanian4-Dec-08 21:46 
Question[Message Deleted] Pin
abc_star_14-Dec-08 20:34
abc_star_14-Dec-08 20:34 
AnswerRe: Invoking webservice from C++ Application Pin
Malli_S4-Dec-08 20:44
Malli_S4-Dec-08 20:44 
General[Message Deleted] Pin
abc_star_14-Dec-08 20:56
abc_star_14-Dec-08 20:56 

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.