Axis APPINT Manual de integración - Página 6

Navegue en línea o descargue pdf Manual de integración para Servidor Axis APPINT. Axis APPINT 10 páginas. Application integration

6. Send the request:
anHttpFile->SendRequest(NULL,
The method will not return ????? until a response is received from the server or
after a time out.
7. If the request is successful, image data will be sent back. Otherwise an HTML
page containing error information will be sent. One way of testing what was sent
back is to look at the Content-type. Its value can be retrieved by the following call:
anHttpFile->QueryInfo(HTTP_QUERY_CONTENT_TYPE,aContType);
If all went well, aContType will have the value "image/jpeg" (if JPEG is the
chosen format. See table above.), otherwise "text/html".
8.
Finally we are ready to receive the data:
UINT bytesRead = anHttpFile->Read(buffer, MAXBUF - 1);
while( nBytesRead > 0)
{
}
Scanning Using the WinInet API
If you do not want to use MFC to create an Internet application you can use the WinInet
API instead. It provides basically the same functionality as MFC does and the functions in
the WinInet API are very similar to those in MFC. In the steps below we describe how the
API is used. For more information, see the WinInet documentation. The following code is
not checked for errors.
1. Call InternetOpen to enable an Internet connection:
HINTERNET anInetHandle =
InternetOpen("ScanSDK",
//Save data somewhere
.
.
.
//Read next chunk
nBytesRead = anHttpFile->Read(buffer,MAXBUF -1);
INTERNET_OPEN_TYPE_DIRECT,
NULL,
NULL,
0);
0,
(void*)(const char*)aQueryString,
aQueryString.GetLength());
6