Author Topic: web navigation O2  (Read 6968 times)

0 Members and 1 Guest are viewing this topic.

Offline Eduardo Jorge

  • Jr. Member
  • **
  • Posts: 69
  • User-Rate: +0/-0
web navigation O2
« on: June 28, 2019, 06:48:22 PM »
where I could find examples of O2 code for Msxml2.XMLHTTP.6.0


example
Code: [Select]
#import "msxml6.dll" 
using namespace MSXML2; 
 
void XMLHttpRequestSample() 

   IXMLHTTPRequestPtr pIXMLHTTPRequest = NULL; 
   BSTR bstrString = NULL; 
   HRESULT hr; 
 
   try { 
      hr=pIXMLHTTPRequest.CreateInstance("Msxml2.XMLHTTP.6.0"); 
      SUCCEEDED(hr) ? 0 : throw hr; 
 
      hr=pIXMLHTTPRequest->open("GET", "http://localhost/books.xml ", false); 
      SUCCEEDED(hr) ? 0 : throw hr; 
 
      hr=pIXMLHTTPRequest->send(); 
      SUCCEEDED(hr) ? 0 : throw hr; 
 
      bstrString=pIXMLHTTPRequest->responseText; 
 
      MessageBox(NULL, _bstr_t(bstrString), _T("Results"), MB_OK); 
 
      if(bstrString) 
      { 
         ::SysFreeString(bstrString); 
         bstrString = NULL; 
      } 
 
   } catch (...) { 
      MessageBox(NULL, _T("Exception occurred"), _T("Error"), MB_OK); 
      if(bstrString) 
         ::SysFreeString(bstrString); 
   } 
 




"VBA code"
Code: [Select]
  Set Site = CreateObject("MSXML2.XMLHTTP.6.0")
         
          Site.Open "GET", strUrl, False
          Site.send
          tjoson = Site.responseText


Offline Charles Pegge

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 674
  • User-Rate: +27/-1
    • Charles Pegge
Re: web navigation O2
« Reply #1 on: June 30, 2019, 04:22:27 AM »
What language is that?  Is it .net code?

Offline Eduardo Jorge

  • Jr. Member
  • **
  • Posts: 69
  • User-Rate: +0/-0
Re: web navigation O2
« Reply #2 on: June 30, 2019, 08:10:48 AM »
https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms759148(v%3Dvs.85)

c, but I just want some example for O2, and being able to have a base, I could not find anything related

Offline Zlatko Vid

  • Newbie
  • *
  • Posts: 47
  • User-Rate: +0/-0
Re: web navigation O2
« Reply #3 on: June 30, 2019, 07:49:22 PM »
If you look into Oxygen basic forum you may found IUP
example for o2 ,i think that John posted about it.
And my small example for ATL..very trivial.
Also look here on Jose Examples for web(ATL browser..i think) and similar.

Offline Eduardo Jorge

  • Jr. Member
  • **
  • Posts: 69
  • User-Rate: +0/-0
Re: web navigation O2
« Reply #4 on: July 01, 2019, 07:33:56 PM »
 Zlatko Vid
Thank you, I'll take a look,
  I just need to get a json and pass it to an array

Offline Zlatko Vid

  • Newbie
  • *
  • Posts: 47
  • User-Rate: +0/-0
Re: web navigation O2
« Reply #5 on: July 02, 2019, 12:19:28 PM »
json is as far as i know javaScript ..right?
so you need html control to produce something with js
and of course control which support java script.

Offline Zlatko Vid

  • Newbie
  • *
  • Posts: 47
  • User-Rate: +0/-0
Re: web navigation O2
« Reply #6 on: July 02, 2019, 12:33:46 PM »
Eduardo
I just looking into open source html control called mCtrl
which have great things.it is 32 and 64 bit in a form of .dll
written in C ,so you can connect it with any windows app
i must invesigate this more...

Offline Eduardo Jorge

  • Jr. Member
  • **
  • Posts: 69
  • User-Rate: +0/-0
Re: web navigation O2
« Reply #7 on: July 02, 2019, 03:48:05 PM »
Zlatko Vid
json is just a text file
in the case here, it is only to use a handful of if within a for loop.
an example of json
http://data.ny.gov/resource/d6yy-54nr.json
with Msxml2.XMLHTTP, the text file can be obtained directly, and just work the file directly

Offline Zlatko Vid

  • Newbie
  • *
  • Posts: 47
  • User-Rate: +0/-0
Re: web navigation O2
« Reply #8 on: July 02, 2019, 06:03:06 PM »
ok
i see but still you need protocol to xml.control
i don't think that someting similar is in any example of o2 but
because i am not very much interested for that I might be wrong.
you must wait for Charles respond...

Offline Eduardo Jorge

  • Jr. Member
  • **
  • Posts: 69
  • User-Rate: +0/-0
Re: web navigation O2
« Reply #9 on: July 04, 2019, 01:58:22 AM »
I think there is no way to do it easily in O2,
so I read the O2 has no implementation use COM
I do not even know where to start
is not quite an important demand, what I did in vba works well, I just wanted to try something on O2 without depending on excel and vba

Offline Charles Pegge

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 674
  • User-Rate: +27/-1
    • Charles Pegge
Re: web navigation O2
« Reply #10 on: July 06, 2019, 10:23:57 AM »
We need some expertise in scripting-com, but o2 now has the infrastructure to support variants.

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 595
  • User-Rate: +11/-8
Re: web navigation O2
« Reply #11 on: July 06, 2019, 12:03:34 PM »
From the dregs of my poor memory I believe Excel is notorious for not following the COM norm making it a bear to code outside of the vba environment.

James

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2483
  • User-Rate: +204/-0
Re: web navigation O2
« Reply #12 on: July 06, 2019, 02:43:33 PM »
WebBrowser, Excel, scripting-COM... OMG

All you need is an interface declaration (something like)

Code: [Select]
'--------------------
class IXMLHttpRequest
'====================

   public

   extends IDispatch

   HRESULT open(BSTR bstrMethod,BSTR bstrUrl,VARIANT varAsync,VARIANT bstrUser,VARIANT bstrPassword)
   HRESULT setRequestHeader(BSTR bstrHeader,BSTR bstrValue)
   HRESULT getResponseHeader(BSTR bstrHeader,BSTR *pbstrValue)
   HRESULT getAllResponseHeaders(BSTR *pbstrHeaders)
   HRESULT send(VARIANT varBody)
   HRESULT abort(void)
   HRESULT get_status(LONG *plStatus)
   HRESULT get_statusText(BSTR *pbstrStatus)
   HRESULT get_responseXML(IDispatch **ppBody)
   HRESULT get_responseText(BSTR *pbstrBody)
   HRESULT get_responseBody(VARIANT *pvarBody)
   HRESULT get_responseStream(VARIANT *pvarBody)
   HRESULT get_readyState(LONG *plState)
   HRESULT put_onreadystatechange(IDispatch *pReadyStateSink)

end class

guidval CLSID_XMLHTTP60, "88D96A0A-F192-11D4-A65F-0040963251E5"
guidval IID_IXMLHTTPRequest, "ED8C108D-4349-11D2-91A4-00C04F7969E8"

And then the usual way of using low-level COM:

CoInitialize NULL
CoCreateInstance(...)
Call the appropriate methods
CoUninitialize

Offline Charles Pegge

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 674
  • User-Rate: +27/-1
    • Charles Pegge
Re: web navigation O2
« Reply #13 on: July 07, 2019, 10:36:11 AM »
Thanks José,

I am puzzled why variants are often passed byval though.
« Last Edit: July 07, 2019, 10:55:56 AM by Charles Pegge »

Offline Zlatko Vid

  • Newbie
  • *
  • Posts: 47
  • User-Rate: +0/-0
Re: web navigation O2
« Reply #14 on: July 07, 2019, 12:39:03 PM »
Quote
I am puzzled why variants are often passed byval though.

Charles

I think they are just another name for integer pointers.

- Aurel