RUVATA Posted June 23, 2011 Share Posted June 23, 2011 I'am sorry for the bad english I have a problem with event handling of "winhttp.winhttprequest.5.1" COM-object Dim $sServerURL = 'http://94.233.79.242:8000' Dim $oHTTP = ObjCreate('winhttp.winhttprequest.5.1') Dim $oEventEmitter = ObjEvent($oHTTP, 'Evt_', 'IWinHttpRequestEvents') $oHTTP.Open("POST", $sServerURL, True) $oHTTP.Send('test') $oHTTP.WaitForResponse() MsgBox(0, $sServerURL & '--Response', $oHTTP.ResponseText()) Func Evt_OnResponseFinished() MsgBox(0,'Event Emitter', 'произошло событие OnResponseFinished') EndFunc Func Evt_OnError() MsgBox(0,'Event Emitter', 'произошло событие OnError') EndFunc this code causes a system error, but AutoIt interpriter have no problem and stop executing with AutoIT3.exe ended.rc:-1073741819 specification to using "winhttp.winhttprequest.5.1" example of working code would be very helpful to me ... Link to comment Share on other sites More sharing options...
water Posted June 23, 2011 Share Posted June 23, 2011 There is a (User Defined Functions) available. This UDF should do what you want or at least give you an idea how to do it yourself. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
RUVATA Posted June 23, 2011 Author Share Posted June 23, 2011 (edited) The WinHTTP.au3 UDF using "winhttp.dll"... resp. based on the WinHTTP C/C++ API Reference but, my application based on the COM-object of winhttp.winhttprequest.5.1, this object also have same functionality and reference... From the Help Manual for AutoIt3: ObjEvent ( $ObjectVar, "functionprefix" [, "interface name"] ) I have an object and know the name of the interface... Why my code does not work? I think I allow a logical error in my code ... Edited June 23, 2011 by RUVATA Link to comment Share on other sites More sharing options...
water Posted June 23, 2011 Share Posted June 23, 2011 From the Help Manual for AutoIt3: ObjEvent ( $ObjectVar, "functionprefix" [, "interface name"] ) Note: It must be a supported as outgoing for theObject AND it must be of type DISPATCHIs this true as well? What error message do you get during run time? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
trancexx Posted June 23, 2011 Share Posted June 23, 2011 The WinHTTP.au3 UDF using "winhttp.dll"... resp. based on the WinHTTP C/C++ API Referencebut, my application based on the COM-object of winhttp.winhttprequest.5.1, this object also have same functionalityand reference...From the Help Manual for AutoIt3:I have an object and know the name of the interface...Why my code does not work?This COM object is hosted by the same DLL an is build upon the same functions.Regardless of that you won't be able to use IWinHttpRequestEvents, primarily because that sort of interfaces are not supported by automation (inherits from IUnknown). New beta AutoIt have ability to detect this kind of situations and report them to the user. Meaning if you use AutoIt beta, there won't be unexpected behaviors. Another thing to consider is reentrant WinHTTP nature during the asynchronous completion callback. This means that even if IWinHttpRequestEvents could be used (future AutoIt versions) you would still have problems with the semantics of your code. mLipok 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
RUVATA Posted June 23, 2011 Author Share Posted June 23, 2011 (edited) OK, Thanks, I suspected that the AutoIt does not support CallBack's fully Edited June 23, 2011 by RUVATA Link to comment Share on other sites More sharing options...
water Posted June 23, 2011 Share Posted June 23, 2011 The answer is in trancexx's reply: "... primarily because that sort of interfaces are not supported by automation ...". Seems you're out of luck and can't do what you try to do My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
RUVATA Posted June 23, 2011 Author Share Posted June 23, 2011 Solution of the problem:You can use 'Msxml2.XMLHTTP.6.0' instead of 'winhttp.winhttprequest.5.1'it allows you to control your condition through a property readyState mLipok 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now