I want to use HttpOpenRequest to download a file from internet using GET. I don't know how to declare the AcceptType parameter. The MS documentations says that it is an array of strings. So I declare it like this:
CONST
AcceptType: packed array[0..1] of LPWSTR = (PChar('*/*'), nil);
I have done something wrong? LPWSTR is a pointer to a string, however, the documentation says that I need a string. How do I declare a matrix of strings that are compatible with C++ ?
procedure THTTPGetThread.Execute;
CONST
AcceptType: packed array[0..1] of LPWSTR = (PChar('*/*'), nil); // Originally was: AcceptType:= PWideChar('Accept: ' + FTAcceptTypes);
VAR
hConnect: hInternet;
FileName: String;
Data: Array[0..1024] of Char;
TempStr: PAnsiChar;
RequestMethod: PChar;
InternetFlag: DWord;
begin
...
hRequest:= HttpOpenRequest(hConnect, RequestMethod, PChar(FileName), PChar('HTTP/1.0'), PChar(FTReferer), @AcceptType, InternetFlag, 0);
...
end;
I use Delphi XE. The MS documentation is here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384233(v=vs.85).aspx My function is multi-threaded so it won't block the program while it downloads. Single threaded functions won't work for me.
AcceptType