Reputation: 23
I need to create simple HTTP request with Windows Phone 8 C++/CX. Where could I find an example?
This http://msdn.microsoft.com/en-US/library/windowsphone/develop/jj662956(v=vs.105).aspx document says IXMLHTTPRequest2
should be supported but I have no idea how to enable it in my project. It is just a standard Windows phone Direct3d native app?
Upvotes: 2
Views: 1762
Reputation: 188
Microsoft's example for IXMLHTTPRequest2, worked for me in windows phone 8 c++/cx
http://msdn.microsoft.com/en-us/library/hh873181.aspx
The only changed I needed to do, was for CreateStreamOverRandomAccessStream which is not implemented in WP8.
Rewrite this method:
void HttpRequest::CreateMemoryStream(IStream **stream)
{
auto randomAccessStream = ref new Windows::Storage::Streams::InMemoryRandomAccessStream();
CheckHResult(CreateStreamOverRandomAccessStream(randomAccessStream, IID_PPV_ARGS(stream)));
}
To this:
void HttpRequest::CreateMemoryStream(IStream** stream)
{
checkHResult(::CreateStreamOnHGlobal(0, TRUE, stream));
}
Upvotes: 7