473,395 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Error in Calling HttpQueryInfo() in VB.Net application

I have a VB6 application which calls HttpQueryInfo() with the following call:
HttpQueryInfo(hHttpRequest, iInfoLevel, sBuffer.Value, lBufferLength, 0)
where hHttpRequest, iInfoLevel and lBufferLength are all integers, and
httpQueryInfo is declared as:
Public Declare Function HttpQueryInfo Lib "wininet.dll" Alias
"HttpQueryInfoA"(ByVal hHttpRequest As Integer, ByVal lInfoLevel As Integer,
ByRef sBuffer As Any, ByRef lBufferLength As Integer, ByRef lIndex As
Integer) As Short
After converting to VB.Net, this declaration generated the following error:
"'As Any' is not supported is not supported in declare statements", with the
following upgrade note:
'UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for
more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1016"'
The documentation of this upgrade issue states that you should determine the
type that is actually being passed, and make the declaration accordingly. In
my application, this parameter (sBuffer) is being passed both as a string and
as an integer, so I changed the declaration to use an object, i.e.:
Public Declare Function HttpQueryInfo Lib "wininet.dll" Alias
"HttpQueryInfoA" (ByVal hHttpRequest As Integer, ByVal lInfoLevel As Integer,
ByRef oBuffer As Object, ByRef lBufferLength As Integer, ByRef lIndex As
Integer) As Short
I try and call this routine and pass a string with the following code:
Dim sBuffer As New VB6.FixedLengthString(1024)
Dim lBufferLength As Integer

lBufferLength = Len(sBuffer.Value)
GetQueryInfoString = CBool(HttpQueryInfo(hHttpRequest, iInfoLevel,
sBuffer.Value, lBufferLength, 0))
When I do this, I get the following error:
"An unhandled exception of type
'System.Runtime.InteropServices.InvalidOLEVariantT ypeException' occurred in
Project1.exe.
Additional Information: Specified OLE variant is invalid"

Jul 21 '05 #1
0 2822

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Programatix | last post by:
Hi, I'm working on a project which includes XML WebServices and Windows Form application. The Windows Form application will call the XML WebServices to retrieve data from database. The data...
3
by: Yitzhak | last post by:
I am having "Permission denied" error while calling LogEvent method of WScript.Shell component. Basically, ASP page calls Windows Script Host Shell component to log events to the OS Application...
0
by: Rhino | last post by:
I've written several Java stored procedures now (DB2 V7.2) and I'd like to write down a few "best practices" for reference so that I will have them handy for future development. Would the...
13
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently...
11
by: suzy | last post by:
i am trying to write aspx login system and the login process requires a validity check of username and password. i have been told that raising exception is costly, but i want a custom error...
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
0
by: Goldsworth_Systems | last post by:
I have a VB6 application which calls HttpQueryInfo() with the following call: HttpQueryInfo(hHttpRequest, iInfoLevel, sBuffer.Value, lBufferLength, 0) where hHttpRequest, iInfoLevel and...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
0
by: pinky22 | last post by:
I am calling SSIS package from a .Net windows UI. Both SSIS & .Net app are created in 2008. The SSIS package is stored in file system. When I ran .Net app I got error- The package failed to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.