How sets IWinHttpRequest::Option property?

Moderator: Rathinagiri

Post Reply
huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

How sets IWinHttpRequest::Option property?

Post 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
Attachments
error information
error information
error_info.jpg (50.35 KiB) Viewed 3390 times
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: How sets IWinHttpRequest::Option property?

Post by mol »

Option is a method, so you can not assign value to it
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: How sets IWinHttpRequest::Option property?

Post 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
There's nothing you can do that can't be done...
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: How sets IWinHttpRequest::Option property?

Post 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.
huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

Re: How sets IWinHttpRequest::Option property?

Post by huiyi_ch »

Thank you very much Edward!
Thanks folks!
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: How sets IWinHttpRequest::Option property?

Post by edk »

慧怡你好。
在我看来,你正在做一些有趣的事情,我希望你会与我们分享你的工作成果。
huiyi_ch
Posts: 172
Joined: Sat May 21, 2016 5:27 am

Re: How sets IWinHttpRequest::Option property?

Post by huiyi_ch »

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