Q: Simple NS-Navigator OLE-problem 
Author Message
 Q: Simple NS-Navigator OLE-problem

OK, I'm not too experienced when it comes to OLE and VB,
therefore I hope the answer to this is easy.

I'm trying to make my app receive a HTML-document from
Netscape via OLE (yes, it needs to go that way).

This is my code (a bit simplified, no checking and so on):

Sub Command1_Click ()
Dim Nav As Object
On Error Resume Next

  Set Nav = CreateObject("Netscape.Network.1")
  res = Nav.Open("about:mozilla", 0, "", 0&, "")
  status& = Nav.GetStatus() ' No problem = 0

'Everything runs fine so far. The first problem
' comes with the following (stays 0 when it should be -1)
' whether or not I place it in a loop doesn't change things

Ready% = Nav.IsFinished()  

' Next problem: Netscape wants a pointer to a string-
' buffer. As I obviously fail at the above line
' I am not sure whether this is OK the way it is.
' Documentation is below the sub

MyBuffer$ = Space$(65000)
DataLength% = Nav.Read(MyBuffer$, 65000)
FileContent = Left$(MyBuffer$, DataLength%)

' Last Problem: The next line is remarked because
' VB only sees "Close()" and thinks about Databases.
' Is there a way to correctly close the OLE-connection?
' (something like Alias or so?)

'bye% = Nav.Close()

End Sub

Documentation on the Read-Command:

Integer Read(PTR to String pBuffer, Integer iAmount)

Where pBuffer is a string-buffer for what Netscape will tell
me and
iAmount is the number of bytes I will allow Netscape to put
in the buffer. The returnvalue is the number of bytes
Netscape actually wrote after the operation.

Well, thanks for any help.

Mathias Schiffer, Germany
VB-FAQ: http://www.*-*-*.com/
NG-tips: http://www.*-*-*.com/

Thu, 28 Oct 1999 03:00:00 GMT  
 Q: Simple NS-Navigator OLE-problem

(Mathias Schiffer) wrote (Sun, 11 May 1997 19:55:31 GMT):

>MyBuffer$ = Space$(65000)
>DataLength% = Nav.Read(MyBuffer$, 65000)

Alright, I got it solved. Thanks in case you tried to
prepare an answer, but it was just that Netscape doesn't
accept such a long buffer. Reducing the 65000 makes all run

Mathias Schiffer, Germany
VB-FAQ: http://home.sol.no/jansh/vb/default.htm
NG-tips: http://www.rat.de/metty/vbnews

Fri, 29 Oct 1999 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. 2 fairly simple database Qs

2. Qs: VB4.0/OLE/ODBC

3. simple OLE problem - making Outlook appear

4. how to use url.Encode for NS problem w/ params in URL

5. A simple Mail problem in search for a equally simple answer

6. COM Add-ns

7. NS BASIC 2.0 for Newton announced

8. Newton Infrared remote control programming using NS BASIC

9. Code to extract URLs from NS and MIE?

10. Simple OLE (Excel)

11. Simple OLE automation question w/ Word

12. I need to ask a Javascript question: NS Specific - CSS Sheets


Powered by phpBB® Forum Software