Programming > Problems & Solutions
COM OLE
JRS:
Charles,
I tried your COM OLE CallByName interface with my MASLink OCX that I'm using with SB.
--- Code: OxygenBasic ---' O2 VB6 $filename "mlink.exe"uses COM/COMutilCoInitialize null CreateInterfaceByName "MASLink.OCXForm" mlobjCallByName(mlobj, "ShowOCXForm") mlobj.ReleaseCoUninitialize
The window never shows. :( No errors, just the cursor does a quick busy icon and that's it.
JRS:
Here is what I'm trying to do in O2. I ran this script from the same COM folder as the O2 version.
--- Code: Script BASIC ---IMPORT COM.sbi obj = COM::CREATE(:SET, "MASLink.OCXForm")COM::CBN obj, "ShowOCXForm" COM::RELEASE obj
Attached is what we should see.
Charles Pegge:
Hi John,
Does this SAPI callbyname example work on your system?
--- Code: --- '16:33 09/11/2020
'10:01 14/03/2021
'com automation
'
$filename "t.exe"
'uses rtl64
uses COM/COMutil
CoInitialize null
CreateInterfaceByName "SAPI.SpVoice" voice
'ConnectByName "SAPI.SpVoice", voice
'
BSTR r
GetByName(voice,"volume",r) : print "vol " r
GetByName(voice,"rate",r) : print "rate " r
CallByName( voice,"speak", BSTR {"Hello World"} )
LetByName(voice,"volume",7)
LetByName(voice,"rate",3)
CallByName( voice,"speak", BSTR {"Hello World","1"} )
'
'Working with variants
======================
indexbase 1
VARIANT va[2]
va.vt[1]=VT_BSTR : va[1].bstrval="Hello Sky"
va.vt[2]=VT_BSTR : va[2].lval=1
CallByNameV( voice, METHOD,"speak", va,2 )
del va.bstrval
print err
...
voice.Release
CoUninitialize
--- End code ---
JRS:
The clipboard SAPI and both COM webrowser examples worked fine. I'll give this example a try as well.
Update
It didn't work. I got the quick busy cursor but no "Hello World". (speakers on)
sapiDemo1.o2bas worked.
CallByName.o2bas didn't work.
Charles Pegge:
I have just uploaded my current version.
If you download it so we are in complete sync, and try again:
https://github.com/Charles-Pegge/OxygenBasic/blob/master/OxygenBasic030.zip
Navigation
[0] Message Index
[#] Next page
Go to full version