• Welcome to Jose's Read Only Forum 2023.

web navigation O2

Started by Eduardo Jorge, June 28, 2019, 06:48:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Eduardo Jorge

where I could find examples of O2 code for Msxml2.XMLHTTP.6.0


#import "msxml6.dll" 
using namespace MSXML2; 
void XMLHttpRequestSample() 

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

"VBA code"

  Set Site = CreateObject("MSXML2.XMLHTTP.6.0")
          Site.Open "GET", strUrl, False
          tjoson = Site.responseText

Charles Pegge

What language is that?  Is it .net code?

Eduardo Jorge


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

Zlatko Vid

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.

Eduardo Jorge

 Zlatko Vid
Thank you, I'll take a look,
  I just need to get a json and pass it to an array

Zlatko Vid

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.

Zlatko Vid

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...

Eduardo Jorge

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
with Msxml2.XMLHTTP, the text file can be obtained directly, and just work the file directly

Zlatko Vid

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...

Eduardo Jorge

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

Charles Pegge

We need some expertise in scripting-com, but o2 now has the infrastructure to support variants.

James C. Fuller

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.


José Roca

WebBrowser, Excel, scripting-COM... OMG

All you need is an interface declaration (something like)

class IXMLHttpRequest


   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
Call the appropriate methods

Charles Pegge

Thanks José,

I am puzzled why variants are often passed byval though.

Zlatko Vid

QuoteI am puzzled why variants are often passed byval though.


I think they are just another name for integer pointers.

- Aurel