Solved

problem using WinInet API

Posted on 2001-06-26
3
1,509 Views
Last Modified: 2008-03-17
Hi all,

We are using wininet API for sending http request and retrieving header information from the server .After sending the request,we use the following API function for retrieving the headers.(HttpQueryInfo)

Private Declare Function HttpQueryInfo Lib "wininet.dll" _
    Alias "HttpQueryInfoA" _
                  (ByVal hHttpRequest As Long, _
                  ByVal lInfoLevel As Long, _
                  ByVal sBuffer As Any, _
                  ByRef lBufferLength As Long, _
                  ByRef lIndex As Long) As Boolean

we can pass follwing attributes for the second argument in queryinfo function

Public Const HTTP_QUERY_CONTENT_TYPE = 1
Public Const HTTP_QUERY_CONTENT_LENGTH = 5
Public Const HTTP_QUERY_EXPIRES = 10
Public Const HTTP_QUERY_LAST_MODIFIED = 11
Public Const HTTP_QUERY_PRAGMA = 17
Public Const HTTP_QUERY_VERSION = 18
Public Const HTTP_QUERY_STATUS_CODE = 19
Public Const HTTP_QUERY_STATUS_TEXT = 20
Public Const HTTP_QUERY_RAW_HEADERS = 21
Public Const HTTP_QUERY_RAW_HEADERS_CRLF = 22
Public Const HTTP_QUERY_FORWARDED = 30
Public Const HTTP_QUERY_SERVER = 37
Public Const HTTP_QUERY_USER_AGENT = 39
Public Const HTTP_QUERY_SET_COOKIE = 43
Public Const HTTP_QUERY_REQUEST_METHOD = 45

(These are having values assigned to them.)


for example
-----------
 If (HttpQueryInfo(hHttpOpenRequest, _
                        HTTP_QUERY_REQUEST_METHOD, sBuff, lBuffLen, 0) _
                        = 1) Then
                        MsgBox sBuff
                      End If

When i give the above constants it gives proper information respectively since the value for all the constants are known .
But if i give the following attribute

     HTTP_QUERY_CONTENT_LOCATION
     ---------------------------

there is no output.Reason is there is no constatnt value assigned for that particular attribute.
so when i give as follows

 If (HttpQueryInfo(hHttpOpenRequest, _
                          HTTP_QUERY_CONTENT_LOCATION , sBuff, lBuffLen, 0) _
                        = 1) Then
                        MsgBox sBuff
                      End If

It gives nothing...In MSDN, it is mentioned that
some attributes don't have value and in that case it could  be done by HTTP_QUERY_CUSTOM  attribute.we tried that also but not able to get the answer.so please tell
me how to get value for the attribute HTTP_QUERY_CONTENT_LOCATION(If possible for other attributes without constants assigned to them)
with sample code,so that i can use it.
           Thanks in advance.

                                             Prabath.

0
Comment
Question by:prabath
3 Comments
 
LVL 1

Accepted Solution

by:
morgan_peat earned 10 total points
ID: 6230415
From wininet.h:

#define HTTP_QUERY_CONTENT_LOCATION             51

Are you using
Public Const HTTP_QUERY_CONTENT_LOCATION = 51
?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7139842
Hi prabath,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept morgan_peat's comment(s) as an answer.

prabath, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7178877
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question