Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

problem using WinInet API

Posted on 2001-06-26
3
Medium Priority
?
1,527 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 40 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
Suggested Courses

596 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