Click here to Skip to main content
15,889,867 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: Invoking webservice from C++ Application Pin
Malli_S4-Dec-08 21:11
Malli_S4-Dec-08 21:11 
General[Message Deleted] Pin
abc_star_14-Dec-08 22:16
abc_star_14-Dec-08 22:16 
GeneralRe: Invoking webservice from C++ Application Pin
Malli_S4-Dec-08 22:34
Malli_S4-Dec-08 22:34 
QuestionHow to get the image contents from the clipboard and write into a BMP file using MFC Pin
Durga.Varun4-Dec-08 20:18
Durga.Varun4-Dec-08 20:18 
AnswerRe: How to get the image contents from the clipboard and write into a BMP file using MFC Pin
enhzflep4-Dec-08 20:22
enhzflep4-Dec-08 20:22 
AnswerRe: How to get the image contents from the clipboard and write into a BMP file using MFC Pin
Rajesh R Subramanian4-Dec-08 20:26
professionalRajesh R Subramanian4-Dec-08 20:26 
GeneralRe: How to get the image contents from the clipboard and write into a BMP file using MFC Pin
Durga.Varun4-Dec-08 21:17
Durga.Varun4-Dec-08 21:17 
AnswerRe: How to get the image contents from the clipboard and write into a BMP file using MFC Pin
Hamid_RT4-Dec-08 20:50
Hamid_RT4-Dec-08 20:50 
GeneralRe: How to get the image contents from the clipboard and write into a BMP file using MFC Pin
Durga.Varun4-Dec-08 21:18
Durga.Varun4-Dec-08 21:18 
QuestionTransparent Window using SetLayeredWindowAttributes Pin
Aabid4-Dec-08 19:48
Aabid4-Dec-08 19:48 
AnswerRe: Transparent Window using SetLayeredWindowAttributes Pin
enhzflep4-Dec-08 20:02
enhzflep4-Dec-08 20:02 

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.