|
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];
BOOL bRead, bRet;
HANDLE hFile;
HINTERNET hSession = InternetOpen(NULL,
INTERNET_OPEN_TYPE_PRECONFIG,
NULL,
NULL,
0);
HINTERNET hConnection = InternetConnect(hSession,
_T("www.crmpanel.com"),
INTERNET_DEFAULT_HTTP_PORT,
NULL,
NULL,
INTERNET_SERVICE_HTTP,
0,
NULL);
BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS );
HINTERNET hRequest = HttpOpenRequest(hConnection,
_T("PUT"),
_T("/temp"),
NULL,
NULL,
NULL,
0,
0);
if (!hRequest)
{
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
|
|
|
|
|
Dhiraj kumar Saini wrote: Is there any way to find that the file is transfered successfully.
If either if the if() conditions in the while() loop fail, you know the transfer was unsuccessful.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I am trying something like Spy++ for html documents to identify child window controls on the html page rendered by a browser. Is there a way I can programmatically access the common controls like button, edit window etc from a html page after the page got rendered in a browser like firefox, IE, Opera etc.
Thank you
cheers
Varghese Paul
|
|
|
|
|
|
|
This[^] may help you !!
- Malli...!
|
|
|
|
|
|
I hope you have to create the proxy class from your server wsdl file, which you can use in your code directly.
- Malli...!
|
|
|
|
|
|
Try using wsdl.exe (.net tool) to build proxy class from the WSDL url.
- Malli...!
|
|
|
|
|
Hi Friends,
I'm newbie to the forum and MFC programming as well. I want to know 'How to get the image contents from the clipboard and write into a BMP file using MFC', Please do the needful.
Thanks ahead for every one.
|
|
|
|
|
Easy tiger, there's no need to shout!
|
|
|
|
|
Durga.Varun wrote: I'm newbie to the forum and MFC programming as well.
Hi there! Welcome aboard.
Durga.Varun wrote: I want to know 'How to get the image contents from the clipboard and write into a BMP file using MFC',
You need to read a book on MFC (if you are any good at Windows programming, then you could skip other chapters, just read the basics of the framework and jump on to the chapter that talks about dealing with bitmaps and GDI in MFC). After you finish it, you will be all set to go.
Durga.Varun wrote: Thanks ahead for every one.
Most welcome.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thanks, I'll get on with some MFC books or on-line stuffs
|
|
|
|
|
|
Thanks for the link, I'll go through that.
|
|
|
|
|
hello all
i am using VS 6.0, VC++, Win32
My Task is to display png image on Transparent window.....
i used SetLayeredWindowAttributes to make my window transparent and it works fine......but the problem is my image also gets transparent and nothing is displayed ......
can anybody suggest me how to overcome this problem.....i.e only window should become transparent but not the image.....
Thankx:::
|
|
|
|
|
You can use an image with a solid colour applied in the parts that should be transparent. You then display the image using alpha keying, which renders the image except pixels that are this colour.
Here is code that displays an an image with 75% opacity, except for pixels that are RGB(255,0,0) - which are not displayed at all.
SetLayeredWindowAttributes(hwnd, RGB(255,0,0), (75*255)/100, ULW_COLORKEY|LWA_ALPHA);
If you remove the |LWA_ALPHA part, you get full opacity on all pixels except the red ones, which are not shown at all.
|
|
|
|
|
Thankx For ur reply
But it gives compilation error as
ULW_COLORKEY undefined
|
|
|
|
|
Oops, sorry about that - i forget which one it is, you need one of these #defines (I think it's the first one)
#define _WIN32_WINNT 0x0601
#define _WIN32_IE 0x0300
|
|
|
|
|
in both #defines i got the same error as
error C2065: 'ULW_COLORKEY' : undeclared identifier
|
|
|
|
|
I think you need one of these (put that into the PreProcessor settings of your project):
_WIN32_IE=0x0500
WINVER=0x0500
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Taken from winuser.h (mingw 3.4.5)
#if (_WIN32_WINNT >= 0x0500)
#define LWA_COLORKEY 0x01
#define LWA_ALPHA 0x02
#define ULW_COLORKEY 0x01
#define ULW_ALPHA 0x02
#define ULW_OPAQUE 0x04
#endif
|
|
|
|
|
Hi all,
I am converting a double value to CString using format but it is giving negative value,
double val3 = val2/(1024*1024);
CString test_size;
test_size.Format(_T("%d"),val3);
AfxMessageBox(test_size);
Can anybody please tell me what is the error. i am coding in vc2008
|
|
|
|
|
What is val2?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|