Solved

problem using WinInet API

Posted on 2001-06-26
3
1,519 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

728 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