Page 1 of 1

How sets IWinHttpRequest::Option property?

Posted: Tue Mar 20, 2018 2:03 pm
by huiyi_ch
Hello,
Why this program is not compiled, always prompt: invalid lvalue ':

Code: Select all

 
#include <hmg.ch>
Function Main
local WinHtt:=Win_OleCreateObject( "WinHttp.WinHttpRequest.5.1")
WinHtt:open("POST","http://www.hmgforum.com/ucp.php?mode=login")
MSGDEBUG(WinHtt:Option(4))
MSGDEBUG(WinHtt:OPTION(6))
WinHtt:OPTION(6)=.F.
Return   

Please help me!
Thanks

Re: How sets IWinHttpRequest::Option property?

Posted: Tue Mar 20, 2018 3:25 pm
by mol
Option is a method, so you can not assign value to it

Re: How sets IWinHttpRequest::Option property?

Posted: Tue Mar 20, 2018 3:37 pm
by serge_girard
Hi,

I see an assignment to option on this site:

http://www.808.dk/?code-simplewinhttprequest

But I cannot get it working!

Serge

Re: How sets IWinHttpRequest::Option property?

Posted: Tue Mar 20, 2018 5:28 pm
by edk
huiyi_ch wrote: Tue Mar 20, 2018 2:03 pm Hello,
Why this program is not compiled, always prompt: invalid lvalue ':

Code: Select all

 
#include <hmg.ch>
Function Main
local WinHtt:=Win_OleCreateObject( "WinHttp.WinHttpRequest.5.1")
WinHtt:open("POST","http://www.hmgforum.com/ucp.php?mode=login")
MSGDEBUG(WinHtt:Option(4))
MSGDEBUG(WinHtt:OPTION(6))
WinHtt:OPTION(6)=.F.
Return   

Please help me!
Thanks
In this case (setting the property with the argument) you should, instead of

Code: Select all

WinHtt:OPTION(6)=.F.
try to use

Code: Select all

WinHtt:_Option( 6, .F. )
As Marek noted, the compiler expects a method that can not be assigned a value.
Therefore, for such properties, you need to change some syntax, precede the name of the property with an underscore and add the last argument: the value that we assign to the property.

Edward.

Re: How sets IWinHttpRequest::Option property?

Posted: Tue Mar 20, 2018 8:33 pm
by huiyi_ch
Thank you very much Edward!
Thanks folks!

Re: How sets IWinHttpRequest::Option property?

Posted: Tue Mar 20, 2018 9:37 pm
by edk
慧怡你好。
在我看来,你正在做一些有趣的事情,我希望你会与我们分享你的工作成果。

Re: How sets IWinHttpRequest::Option property?

Posted: Tue Mar 20, 2018 10:12 pm
by huiyi_ch
Edward老师,您好:
首先,非常感谢您给予我及时的帮助!我认为您是一位天才!是的,我正在用HMG做一个网页爬虫程序。我会与大家分享我的经验。谢谢!