Fred
2006-02-26 05:07:44 UTC
Hi, for "fun" I am trying/testing wininet asynchronous code.
If I compile under UNICODE compile option I can only get
InternetReadFileEx() to work if I "hardcode" to the ANSI Version thus:
char lpReadBuff[256];
INTERNET_BUFFERSA InetBuff;
FillMemory(&InetBuff, sizeof(InetBuff), 0);
InetBuff.dwStructSize = sizeof(InetBuff);
InetBuff.lpvBuffer = lpReadBuff;
InetBuff.dwBufferLength = sizeof(lpReadBuff) - 1;
err0=InternetReadFileExA( g_hRequest,
&InetBuff,
0,
(DWORD)p_rf);
this works returning 1 and accessing the callback function.
If I do:
TCHAR lpReadBuffT[256];
INTERNET_BUFFERS InetBuffX;
FillMemory(&InetBuffX, sizeof(INTERNET_BUFFERS), 0);
InetBuffX.dwStructSize = sizeof(INTERNET_BUFFERS);
InetBuffX.lpvBuffer = (LPVOID)lpReadBuffT;
InetBuffX.dwBufferLength = sizeof(lpReadBuffT) - 1;
err0=InternetReadFileEx( g_hRequest,
&InetBuffX,
0,
(DWORD)p_rf);
Then the function returns 0, the callback function isn't accessed and
GetLastError() gives:
120=INTERNET_STATUS_INTERMEDIATE_RESPONSE
If there isn't a ready fix, is it safe to stick with the ANSI version even
though the prog is compiled under UNICODE?
TIA
If I compile under UNICODE compile option I can only get
InternetReadFileEx() to work if I "hardcode" to the ANSI Version thus:
char lpReadBuff[256];
INTERNET_BUFFERSA InetBuff;
FillMemory(&InetBuff, sizeof(InetBuff), 0);
InetBuff.dwStructSize = sizeof(InetBuff);
InetBuff.lpvBuffer = lpReadBuff;
InetBuff.dwBufferLength = sizeof(lpReadBuff) - 1;
err0=InternetReadFileExA( g_hRequest,
&InetBuff,
0,
(DWORD)p_rf);
this works returning 1 and accessing the callback function.
If I do:
TCHAR lpReadBuffT[256];
INTERNET_BUFFERS InetBuffX;
FillMemory(&InetBuffX, sizeof(INTERNET_BUFFERS), 0);
InetBuffX.dwStructSize = sizeof(INTERNET_BUFFERS);
InetBuffX.lpvBuffer = (LPVOID)lpReadBuffT;
InetBuffX.dwBufferLength = sizeof(lpReadBuffT) - 1;
err0=InternetReadFileEx( g_hRequest,
&InetBuffX,
0,
(DWORD)p_rf);
Then the function returns 0, the callback function isn't accessed and
GetLastError() gives:
120=INTERNET_STATUS_INTERMEDIATE_RESPONSE
If there isn't a ready fix, is it safe to stick with the ANSI version even
though the prog is compiled under UNICODE?
TIA