How to use the WinHTTP WinHttpRequest COM object

Hi all,
I am trying to use WinHTTP with Delphi 6. I have windows 2000pro
After I imported the WinHTTP 5.1 using "Import type library" successfully,This is what I did:
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OleServer, WinHttp_TLB;
...
...
...

procedure TForm1.FormCreate(Sender: TObject);
var o: TWinHttpRequest;
begin
o:= TWinHttpRequest.Create(Application);
o.Open ('GET', 'http://www.mysite.net/cgi-bin/test.cgi', False);
o.Send; //<- I get here: (Access violation at address 0044E3F8 in module 'Project2.exe'. Write of address 000000C8)
end;

end.

*I also want to use the Event of TWinHttpRequest .*

Why am I getting this!? Can you help me?
Thanks in advance
0
kill
10/4/2009 3:34:07 AM
embarcadero.delphi.nativeapi 1236 articles. 1 followers. Follow

6 Replies
4087 Views

Similar Articles

[PageSpeed] 52
Get it on Google Play
Get it on Apple App Store

The next Code is from Winhttp_TLB.pas,Why All Case condication is -1?????
There are some wrongs?

procedure TWinHttpRequest.InvokeEvent(DispID: TDispID; var Params: TVariantArray);
begin
  case DispID of
    -1: Exit;  // DISPID_UNKNOWN
(*{The DispID for this method is DISPID_UNKNOWN!?. }
    -1: if Assigned(FOnResponseStart) then
         FOnResponseStart(Self,
                          Params[0] {Integer},
                          Params[1] {const WideString});
*)
(*{The DispID for this method is DISPID_UNKNOWN!?. }
    -1: if Assigned(FOnResponseDataAvailable) then
         FOnResponseDataAvailable(Self, {??PSafeArray}OleVariant((TVarData(Params[0]).VPointer)^) {var  ??PSafeArray OleVariant});
*)
(*{The DispID for this method is DISPID_UNKNOWN!?. }
    -1: if Assigned(FOnResponseFinished) then
         FOnResponseFinished(Self);
*)
(*{The DispID for this method is DISPID_UNKNOWN!?. }
    -1: if Assigned(FOnError) then
         FOnError(Self,
                  Params[0] {Integer},
                  Params[1] {const WideString});
*)
  end; {case DispID}
end;
0
kill
10/4/2009 3:37:35 AM
If I remember well, the event system of IWinHttpRequest is made to work with 
microsoft jscript event system... that don't work this way...
JScript events are just IDispatch functions made to respond to a 
DISPID_VALUE invoke...
Delphi don't import correctly, since, there is no "On" events as OleVariant 
to use... this may the cause of the access violation (imperfect interface 
declaration)...
0
sergio_ag
10/6/2009 5:48:18 AM
I just research a bit, and found some hints, real ones...
Events on IWinHttpRequest must do through IConnectionPointContainer, 
implementing a IWinHttpRequestEvents object.
WaitForResponse fails on empty param, but you can use INFINITE or MAXINT... 
I call the methods using late binding, I'll try using the default interface 
call anyway...
0
sergio_ag
10/6/2009 6:26:52 AM
> {quote:title=Sergio Gianezini wrote:}{quote}
> I just research a bit, and found some hints, real ones...
> Events on IWinHttpRequest must do through IConnectionPointContainer, 
> implementing a IWinHttpRequestEvents object.
> WaitForResponse fails on empty param, but you can use INFINITE or MAXINT... 
> I call the methods using late binding, I'll try using the default interface 
> call anyway...


Thank you very much!

Can you give a simply Example?
0
kill
10/7/2009 3:43:20 AM
Look in attachments, i post under the name of "WinHTTPRequest Wrapper with 
IConnectionPoint for Events", is a component ready-to-use, with envents and 
some extras...
0
sergio_ag
10/7/2009 11:20:03 PM
Thank You.
0
kill
10/10/2009 7:51:15 AM
Reply:

Similar Artilces:

Code regardin post: Spread 8 COM
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --JivePart=_5f856.zeB8CwDOH5aMJzMl Content-Type: text/plain; charset="Utf-8" Code samples Spread Custom Cell Sample.zip = Delphi code Spread_ActiveX_Samples.zip = GrapeCity sample (VB, VC) -- Regards, Ronald Hoek Application Developer ComponentAgro B.V. Oud-Beijerland - The Netherlands http://www.componentagro.nl KvK: H24264020 --JivePart=_5f856.zeB8CwDOH5aMJzMl Content-Type: application/zip; name="Spread_Act...

Accessing a Com object using Get Object
* Wasn't sure which section to put this in, but found similiar topics in here. We have a slight problem trying to access a COM Object. Reading some of the threads in this forum, people have mentioned trying to connect to a COM Object, but everyone has suggested using CreateObj. We cannot do this as the object is already created, we need to Get this object. Obviously you can use the GetObj command in VB6, but we cannot find away of Getting this object either through a webservice. Feel free to move this to the correct forum. Any help will be greatly recieved. Regards C ...

How design a COM using Delphi and Using in PB7?
I need some component, So, we want using DELPHI5 to develop a COM or Activex. What type of knowege or Skill I must know it. Can anyone tell us? from DRAOGN Can you explain what type of component you want to create? You may not need to a) build your own, or b) use Delphi. If the component should be used from within a PB application, you ought to use PB to develop it unless it is something that PB does not let you do. regards, Bill DRAGON wrote: > I need some component, So, we want using DELPHI5 to develop a COM or > Activex. > What type of knowege or Skill I ...

Using COM objects from within an ASP.Net server object
I am trying to instantiate a COM object from within an ASP.Net server object. The code is all in C#, and am having trouble beacause I do not have access to the Server.CreateObject functionality (because I am not on a page). Any ideas? I've tried using the tlbimp.exe utility as well, and although a wrapper DLL is created, I can't seem to import the dll using a: using mynewnamespace; With ASP.NET you can make a reference to any TLB registered on the machine, and use early-binding to create REAL objects instead of generic OLE stuff created using CreateObject .... are you using ...

Using com objects
Hi all! ASP.NET C# This works fine: Object objMagellan = Server.CreateObject("Magellan.auto"); but when i try to: objMagellan.SetExtractPageAsJpeg(1); i get: CS0117: 'object' does not contain a definition for 'SetExtractPageAsJpeg' (the command works fine in old school asp) What am I doing wrong? Regards Summer I have also tried the tlbimp.exe + ildasm.exe combination and made a dll which I could import as a namespace. I can see the class and its members in ildasm but executing them from the aspx page seems impossible. Please help =) Regs Summer can your run the component in any other environment?"Never argue with an idiot; He will drag you down to his level and beat you with experience" Well!, try to instantiate as below Dim COMinter As New Magellan.auto Then call your function, then it shoudl work.. For more info on COm interop check below link http://www.msdnaa.net/Resources/Display.aspx?ResID=1493 It might help you!!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti...

use com objects
Iam using a windows application's com objects and porting it for the web using visual studio 2005, c#. I get an error RPC_E_SERVERFAULT when i call the com methods on the web. I think it is coming from the model progress bar window and the cursor. How can i bypass that? I have no access to the source code of the windows application. Thank you...

Is possible use PB Object as like COM/OLE Object but in Java, with a Proxy class ??
I'd like to use my PB object from Apache/Tomcat without EAServer ,is it possible ??? What about Java Proxy project in PB 6.5-7, what was this ?? Thanks in advance You can use PB Components in any clients, Java,VB,PB,Delphi etc etc etc "Mirko Di Tommaso" <mirko@tiscali.it> wrote in message news:j9VZLGSJCHA.654@forums.sybase.com... > I'd like to use my PB object from Apache/Tomcat without EAServer ,is it > possible ??? > > What about Java Proxy project in PB 6.5-7, what was this ?? > > Thanks in advance > > Can you ...

To use or not to use Delphi
Sadly, it seems to me that there is a sort of race between the two threads, for and against using Delphi in new projects, with more or less the same users posting in both threads. Arguments are fiercely debated in both camps. Borland had their own vision. As a community, now that Delphi has changed ownership I believe we should try to be more consistent, more clear, and more articulate in what we expect from Embercadero in terms of Delphi. We can contribute to keeping Delphi alive and moving in the right direction. "Laurent Cocea" schrieb: > Sadly, it seems to me that there is a sort of race ... <snip> Some people go fishing, some go to the movies, some like to take long walks on the beach, and then some like to type their fingers bloody discussing totally irrelevant issues on public Newsgroups. And my wife likes to watch soap operas and follow posts from a forum where new-baked parents are discussing their kids-issues. Everyone needs a hobby :-) Regards, Danijel Laurent Cocea wrote: > Sadly, it seems to me that there is a sort of race between the two > threads They're essentially the same thread with a little more trolling in one than the other. Lots of free time over the holidays and all. I think the discussion in general is a good thing, though. Help remind people why a tool like Delphi is worth while, and maybe even shed some light on some of the things that still need attention. I still learn about ...

using pfc in a COM-object
Hello, I've been experimenting a bit with COM-objects and their possibilities. I've also tried to use the PFC in a COM-objects. Building an object worked but when I tried to use the object in another application it didn't work. I assume it has something to do with gnv_app. Has anyone got experience with this? Is this possible? Thanks, Geert ...

using COM object in PB
Hello, Just wondering what are the necessary things to take care when we are using a COM object in our PB program. I didn't have much knowledge on using a COM object in PowerBuilder. Recently, I was on a assignment on researching how to send fax from a PB program. After looking around for I while, I came across a COM object(Microsoft Fax Service on Windows 2000) which matches the exact functionality I'm looking for. But until now I haven't been able to make use of the object in PB. I tried in VB though, and it work just fine. Here are my code. I hope somebody could help ...

How can i use object from delphi?
Can I use delphi to wrap a VCL control in DLL, then I call it from PB, can I? Is Pb only can load external object from the dll which C++ Builder makes? thank you! Yes you can. I created a dll in delphi to control some external scales for weighting of lab samples. With in the delphi, create functions calls as normal. And create the dll Load the dll in the windows root directory. Within PB set up external function calls using the function names and variables and the name you gave the dll. This should make PB access the delphi functions. Jon ...

Using VC++ COM object
Hi, We have created a COM library using ATL without MFC in VC++ 6.0. The compiled library is an executable file, not a DLL. One of our customers would like to use this library from PowerBuilder (V6.5 - upgrade possible if needed). They say the library can not be used. Also it cannot be seen in the PB object browser. Since we do not use PowerBuilder ourselves, we do not have the needed know how to be able to present a solution. Is there any way that our library can be used in PowerBuilder with or without modification (without modification is prefered of course)? Additional in...

Using COM object in ASP
My user object doesn't give error when I use it in a visual datawindow,but it gives me an error when I use it in an A.S.P. When I do datastore lds_1 lds_1 = create datastore lds_1.dataobject = "d_ds_det" ll_righe = lds_1.settransobject(sqlca) return ll_righe it returns me -1. sqlca is a valid transaction (If I do return sqlca.property ,it returns me a valid valors) => datastore doesn't see nonvisual datawindow (d_ds_det) ! How can I resolve my problem? Hi, In your project that you use to build your com/mts component, on the l...

Troubles using an object com
Can someone help me? I have troubles trying to create an object COM that a have to use in an ASP project. Do you have any code sample that could be usefull? How do I call the powerbuilder dll from Asp Many thanks Paola ---== Posted via the PFCGuide Web Newsreader ==--- http://www.pfcguide.com/_newsgroups/group_list.asp ...

how to use COM component in Delphi Prism?
In MS Visual Studio Shell 2010 (Delphi Prism IDE), i want to use a vector graphic tool either VeCAD or LiteCAD. But both of them are OCX / DLL files. They are shown in toolbox (choose item option), as COM component, not as .Net Framework component. How to use COM component into Delphi Prism? these component also shown in toolbox items. But i can't drag them on form. it gives error "Failed to create component AxHost. System.Reflection.TargetInvocationException: COM target doest not implement IDispatch" What is the reason behind it? How to solve this problem? ...

COM Object
We are facing a typical problem regarding use of powerbuilder to develop COM/MTS Objects. The thing is that we have made few GLOBAL FUNCTIONS which return some formats and we use these global functions in the format expression of some fields in datawindow. Eventually these thing doesn't work ( I mean format on fields are not applied ) , when running this com object on MTS . The same thing works fine with our another application which is an ordinary powerbuilder client server exe( Not COM MTS) It seems that Use of GLOBAL FUNCTIONS is prohibited( not sure) in case of COM/M...

Using a Pb COM object from ASP
Hi all. I have created a COM object using PowerBuilder. This object was registered using RegSvr32. I can call it from PHP/Apache with no problems. Now I'm trying to call it from an ASP page inside IIS, but I'm getting error 0177. What am I missing? TIA Diego Marrero www.vegati.com Diego, Make sure that you copy the Powerbuilder virtual machine and Pb datawindow dll's to the windows system directory Thanks, Srikanth > Hi all. > I have created a COM object using PowerBuilder. This > object was registered using RegSvr32. I can call it from > P...

In over my head here, using a COM object in VWD2005
Don't know if this is the right group or not but any how. I found this Automation stuff for Word at this site. The Code Project. Your visual Studio .Net homepage. I followed all the directions on the page, downloaded the example and it works fine. Did the COM referance thing and all seemed fine, but it doesn't work. I'm not even into this COM stuff so as the subject says I'm in over my head here. This is what I have for an error code: Unable to cast COM object of type 'Word.ApplicationClass' to interface type 'Word._Application'. This operation failed because the QueryInterface call on the C...

how to use events in PB for COM objects?
is there a way I can "see" events in a COM server that I link to? right now I need to create a function inside the server that tells me which event fired so I can handle it. Is there a nicer way of doing this? ...

Use OLE COM Objects in PowerBuilder
Does anyone have an example of using OLE objects from PB4 or PB5? I have a class library that works in VB/VC/VFP, but I do not know how to instanciate an object and use it's methods/properties in PB. Thank you in advance. Take a look at the CreateObject() function. Does that help? Regards Costas Tsaklas[Team Powersoft] Elevated Technologies, Inc. www.elevatedtech.com Bob Whelan wrote in message <3467BB57.599F4519@pin-corp.com>... >Does anyone have an example of using OLE objects from PB4 or PB5? >I have a class library that works in VB/VC/VFP, but I do no...

Using a COM object (specifically, Photoshop)
I'm trying to use the Photoshop Object Library, but when I try to create an application object, I get the following error: "System.Runtime.InteropServices.COMException: Server execution failed". I don't think that it's a problem with permissions because I got a different message for that and I've fixed it by adding ASP_NET to the Administrators group (its just for testing...). I tried the exact same code in a regular win32 program and it worked fine. Anyone know what that error means/how to fix it? Thanks. Hi there, Try using impersonation in your web.config. You will have to g...

Creating COM objects using Pocketbuilder
Hello all. Is it possible to create a COM object using PocketBuilder that other applications running on a Pocket PC can call ? Thanks in advance. Hi: You can use Web Services in CodeXchange there are examples http://www.sybase.com/developer/codexchange Ruben Pillaca TechEra www.techeras.com Lima - Peru. > Hello all. > > Is it possible to create a COM object using PocketBuilder > that other applications running on a Pocket PC can call ? > > Thanks in advance. Thanks very much. I will give it a try. > Hi: > > You can use Web Services ...

Listing PBLreports using COM object
Hi All, I would like to list reports informations (date, comments, names) stored in PBL libraries. So i created a COM object ( createobject(Powerbuilder.application)) in a vb script. But i couldn't find methods to access the reports properties. Could you please help me ? Create a method in the COM PB object. In that new method use the LibraryDirectory ( ) method to introspect your PBLs! "pe" <pe@versailles.iufm.fr> wrote in message news:42aedd11@forums-1-dub... > Hi All, > > > I would like to list reports informations (dat...

Re-use tInterfacedObject as COM object ?
Hi everyone, I've written a large collection of interface-based classes that descend from tInterfacedobject. Inside these interfaces, I only use types that are suitable for being passed to and fro between applications and DLL's (such as interfaces, integers, widestrings, doubles and wordbool) and I use the "Stdcall" calling convention in all methods. This way, I can easily implement the classes and class factories inside DLL's and pass the interfaces between the DLL and the calling executable. This works perfectly an d I've really fallen in love with interfaces. ...

Web resources about - How to use the WinHTTP WinHttpRequest COM object - embarcadero.delphi.nativeapi

KBTX - My Capture
Gray Television, Inc. - Copyright © 2002-2012 - Designed by Gray Digital Media - Powered by Clickability User Agent: Mozilla/4.0 (compatible; ...

KKCO - My Capture
11 News, Grand Junction's News Leader, Eleven Minutes of Non-Stop News, No-Wait Weather, Montrose News Gray Television, Inc. - Copyright © 2002-2013 ...

KXII - My Capture
Local News, Weather, Sports, Severe Weather, and Breaking News Coverage for Sherman TX, Denison TX, Ardmore OK, Durant OK, Ada OK Gray Television, ...

WMTV - MyCapture
Gray Television, Inc. - Copyright © 2002-2012 - Designed by Gray Digital Media - Powered by Clickability User Agent: Mozilla/4.0 (compatible; ...

WEAU - My Capture
Gray Television, Inc. - Copyright © 2002-2012 - Designed by Gray Digital Media - Powered by Clickability User Agent: Mozilla/4.0 (compatible; ...

WHSV - My Capture
Harrisonburg, Staunton, Waynesboro, Shenandoah Valley, Breaking News, News, Weather, School Closings, Traffic from WHSV News 3, James Madison ...

WIBW - My Capture
Capture Kansas Gray Television, Inc. - Copyright © 2002-2012 - Designed by Gray Interactive Media - Powered by Clickability User Agent: Mozilla/4.0 ...

My Capture - 23 WIFR Rockford - The Next Generation of News
&nbsp Gray Television, Inc. - Copyright © 2002-2013 - Designed by Gray Digital Media - Powered by Limelight Networks User Agent: Mozilla/4.0 ...

WKYT - MyCapture
Gray Television, Inc. - Copyright © 2002-2012 - Designed by Gray Interactive Media - Powered by Clickability User Agent: Mozilla/4.0 (compatible; ...

WTVY - MyCapture
News 4, Your News Leader, 4 Warn Desktop Alert, Dothan, Wiregrass, WTVY Marketplace Gray Television, Inc. - Copyright © 2002-2013 - Designed ...

Resources last updated: 3/29/2016 8:49:22 PM