Solved

problem using WinInet API

Posted on 2001-06-26
3
1,512 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 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