Jump to content

Using Inernet Transfer Protocol.


Recommended Posts

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("AForm1", 633, 454, 193, 115)
$Obj1 = ObjCreate("InetCtls.Inet.1")
$Obj1_ctrl = GUICtrlCreateObj($Obj1, 8, 8, 32, 32)
$Edit1 = GUICtrlCreateEdit("", 96, 64, 249, 265)
$oRes = $Obj1.OpenURL("http://google.com/")
GUICtrlSetData(-1, $oRes)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

$oRes, should contain the source code, But it always returns "0".

Using the object works fine in VB6 though.

Any ideas on what im doing wrong?

Edited by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

That code works, but its not what I want, Because I cant POST with _INetGetSource.

Seems not many people have the Inet object too. I think ive only got it, because I have VB6 installed...

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

So what are you trying to accoplish in the end? you can simulate and post by embeding the value that would have been in the serach field into the url-

#include <inet.au3>
$inputbox=InputBox("What to search for","Enter search string")
$res=_INetGetSource("http://www.google.com/search?hl=en&q="&$inputbox)
MsgBox(0,"http://www.google.com/search?hl=en&q="&$inputbox,$res)

Or you wanted somthing else?

Link to comment
Share on other sites

That isnt "simulating a post", Thats still a GET request. The &q=, Is a GET variable, Not a POST one.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

One option would be to use the lesser known optional paramter of _INetGetSource to specify a custom http header. It uses the InternetOpenUrl() form wininet fucntion lib (http://msdn2.microsoft.com/en-us/library/aa385098.aspx) and if you look at the header info (http://msdn2.microsoft.com/en-us/library/aa384247.aspx) you'll see that

The function also lets the client specify optional data to send to the HTTP server immediately following the request headers. This feature is generally used for "write" operations such as PUT and POST.

But i think the best thing to do is use the IE library to post it (_IEFormSubmit () )

Edited by evilertoaster
Link to comment
Share on other sites

That isnt "simulating a post", Thats still a GET request. The &q=, Is a GET variable, Not a POST one.

Man, you ARE doing it the hard way, Dude! This works with IE.au3 UDF:

#include <GUIConstants.au3>
#include <IE.au3>
Opt("GuiOnEventMode", 1)
$Form1 = GUICreate("AForm1", 800, 600)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
$Obj1 = _IECreateEmbedded()
If IsObj($Obj1) Then
    $Obj1_ctrl = GUICtrlCreateObj($Obj1, 10, 10, 780, 385)
    $Edit1 = GUICtrlCreateEdit("", 10, 405, 780, 385)
    GUISetState(@SW_SHOW)
    _IENavigate($Obj1, "http://google.com/")
    $oRes = _IEBodyReadHTML($Obj1)
    GUICtrlSetData($Edit1, $oRes)
Else
    MsgBox(16, "Error", "Failed to create object: InetCtls.Inet.1")
EndIf

While 1
    Sleep(20)
WEnd

Func _Quit()
    Exit
EndFunc   ;==>_Quit

When I try to use your code, $oObj1 is not created (tested it with IsObj()).

:whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...