473,387 Members | 1,492 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,387 software developers and data experts.

How to marshall parameters in winhttpopenrequest()?

hi
i am using the following c# code in winhttp to open a http request
Win32Api.WinHttpOpenRequest(Winconnection,"POST","/winn/01Primary/",null,"W*INHTTP_NO_REFERER",WINHTTP_DEFAULT_ACCEP T_TYPES,0x00800000);
and my function marshalling looks like
[DllImport("winhttp.dll",
SetLastError=true)]
public static extern IntPtr WinHttpOpenRequest(

IntPtr hConnect,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszVerb,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszObjectName,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszVersion,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszReferrer,
ref byte[] ppwszAcceptTypes,
int dwFlags);
i don't know what is the constant value for
WINHTTP_NO_REFERER and WINHTTP_DEFAULT_ACCEPT_TYPES
to be specified in the WinHttpOpenRequest() function for these two
parameters
[MarshalAs(UnmanagedType.LPWStr)]
string pwszReferrer,
ref byte[] ppwszAcceptTypes,
please help me regarding this issue
regards
bharathi

Nov 17 '06 #1
1 3933
Hi Bharathi,

Have you seen the System.Net.HttpWebRequest class?

"HttpWebRequest Class"
http://msdn2.microsoft.com/en-gb/lib...ebrequest.aspx

I'm not sure if it'll do what you want, but it's probably worth checking out.

--
Dave Sexton

"selva" <ks**********@yahoo.co.inwrote in message
news:11*********************@j44g2000cwa.googlegro ups.com...
hi
i am using the following c# code in winhttp to open a http request
Win32Api.WinHttpOpenRequest(Winconnection,"POST","/winn/01Primary/",null,"W*INHTTP_NO_REFERER",WINHTTP_DEFAULT_ACCEP T_TYPES,0x00800000);
and my function marshalling looks like
[DllImport("winhttp.dll",
SetLastError=true)]
public static extern IntPtr WinHttpOpenRequest(

IntPtr hConnect,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszVerb,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszObjectName,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszVersion,
[MarshalAs(UnmanagedType.LPWStr)] string
pwszReferrer,
ref byte[] ppwszAcceptTypes,
int dwFlags);
i don't know what is the constant value for
WINHTTP_NO_REFERER and WINHTTP_DEFAULT_ACCEPT_TYPES
to be specified in the WinHttpOpenRequest() function for these two
parameters
[MarshalAs(UnmanagedType.LPWStr)]
string pwszReferrer,
ref byte[] ppwszAcceptTypes,
please help me regarding this issue
regards
bharathi
Nov 17 '06 #2

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

Similar topics

7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
3
by: Bill Cart | last post by:
The oldDb Command does not support Named Parameters. If I am reading them correctly, the docs say that the order of the parameter should match the order they are declared in the Stored Procedure....
0
by: Dgdege | last post by:
Hi all, I want to wrapp an exiting API written in C++ to .NET using managed C++ extensions. I want my managed C++ class library to link with the unmanaged dll. So I don't use PInvoke for...
2
by: - HAL9000 | last post by:
Hello visual basic warriors, It appears as though I have successfully written a system level WH_JOURNALRECORD using visual studio dot net 2002. I do seem to be getting mouse and keyboard...
55
by: salad | last post by:
I have contained in a listbox the Window's caption, the class name for the window, and the hWND of the window. Is there a way, using the data from above, to activate/set focus to that window?
14
by: cody | last post by:
I got a similar idea a couple of months ago, but now this one will require no change to the clr, is relatively easy to implement and would be a great addition to C# 3.0 :) so here we go.. To...
2
by: Hexman | last post by:
Hello All, Well I'm stumped once more. Need some help. Writing a simple select and update program using VB.Net 2005 and an Access DB. I'm using parameters in my update statement and when trying...
6
by: HolyShea | last post by:
All, Not sure if this is possible or not - I've created a class which performs an asynchronous operation and provides notification when the operation is complete. I'd like the notification to be...
2
by: =?Utf-8?B?QmFydE1hbg==?= | last post by:
Greetings, I am trying to copy an unmanaged buffer into a mananged buffer, and trying to use marshalling, and I am not having any success because it doesn't seem to complie. Basically I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.