OLE automation - calling method function with string par by reference 
Author Message
 OLE automation - calling method function with string par by reference

I'm trying to put together a VB program to access Netscape's built-in OLE
automation. I'm able to create the netscape object and open a URL fine:

    Dim NetscapeObject As object
    Set NetscapeObject = CreateObject("Netscape.Network.1")
    iRc% = NetscapeObject.Open("http://randall/cgi-win/ddeclnt.exe/0", 0, 0, 0, 0)
    Dim str1 As String * 255
    While Not NetscapeObject.IsFinished
        iBytes% = NetscapeObject.Read(str1$, 250)
        Debug.Print str1$

However, to read the data from the web page the Read method is used (defined in C):

    short Read(BSTR* pBuffer, short iAmount);

Basically (haha) I can't figure out how to pass a string reference to this method.
pBuffer is where the data is returned to, but Basic comes up with a runtime error on
the read method "OLE Automation argument type mismatch" no matter how things are

This sort of thing is normally (like for Windows api or other DLL functions) done by
declaring the function parameters as "ByVal" ahead of time, but there doesn't seem
to be a way to declare OLE object methods this way.

Has anyone done this? Any ideas? Thanks in advance...

ps I'm not a VB programmer by trade (almost anything but), but all those .VBXs are
too easy to use to pass up...

randall g   http://www.*-*-*.com/ ~randallg

When You let me fall, grew my own wings, now I'm as tall as the sky
When You let me drown, grew gills and fins, now I'm as deep as the sea
When You let me die, my spirit's free, there's nothing challenging me
        - James

Tue, 10 Mar 1998 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Calling Excel's Close method w/ OLE Automation

2. Ole Automation Error when calling Run method of IWshShell_Class

3. OLE Automation object references

4. Function call via string parameter in other function ?

5. Passing String By Ref To OLE Automation Server

6. Quit method causes crash called from automation

7. OLE Automation call to GET FILEINFO from WORD document

8. Calling OLE Automation servers from Tray Icon won't work

9. Remote OLE automation and recursive calls

10. object, method and function reference for VBA

11. calling methods no a particular instance of an ole server

12. Automation: Calling an Excel function in Access


Powered by phpBB® Forum Software