Solved

problem using WinInet API

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now