NEWCOM CLSID with vbRichClient RC6 PowerBASIC Peer Support Community (original) (raw)

I am attempting to use the vbRichClient RC6 with PowerBasic 10.04.0108

I can create a COM Object okay,
and I can call a Method,
but I'm not getting the same results as I do with VBScript and the registered RC6.dll

Specifically, I am calling a Method that should return the argument with a NewLine.

The Method is AddNL.

The Method, however, does not return the argument with a NewLine.

It just returns the argumet without the NewLine.

Yes, I can add a NewLine to the returned argument,
but if I do not have to do that in VBScript,
I should not have to do that in PowerBasic.

Code:

#COMPILER PBWIN 10 'PBWIN 10.04.0108 #COMPILE EXE #DIM ALL

'PowerBasic 10 has the STRINGBUILDER object.

'I'm just using the StringBuilder object from RC6 as a test example, 'to see if I can get it working with NEWCOM CLSID

'There are many more classes in the RC6 framework.

'vbRichClient RC6 Ref: https://www.vbrichclient.com/en/Downloads.htm 'vbRichClient RC6 Ref: https://www.vbforums.com/showthread.php?894955-vbRichClient-(RC6)-amp-RC6-Widgets-Docs-UPDATED 'vbRichClient RC6 Ref: https://www.vbforums.com/showthread.php?897817-Registry-Free-Object-Instantiation-using-DirectCOM-amp-RC6

'This works in VBScript, with the Registered RC6.DLL;

'Dim rc 'Set rc = CreateObject("RC6.cStringBuilder") 'With rc ' .AddNL "One" ' .AddNL "Two" ' .AddNL "Three" ' WScript.Echo .ToString 'End With 'Set rc = Nothing ' 'Microsoft (R) Windows Script Host Version 5.812 'Copyright (C) Microsoft Corporation. All rights reserved. ' 'One 'Two 'Three

#INCLUDE "Win32API.inc" CLSIDclsStringBuilder=GUIDCLSID_clsStringBuilder = GUIDCLSIDclsStringBuilder=GUID("{8BF37C34-25F8-4605-BEF0-5069594FAA8C}")

FUNCTION PBMAIN () AS LONG DIM RC6 AS IDISPATCH DIM hWin AS LONG DIM theVar AS STRING

'Make sure all of these files are in the same folder ' cairo_sqlite.dll ' DirectCOM.dll ' RC6.dll ' RC6Widgets.dll ' WebView2Loader.dll

LET RC6 = NEWCOM CLSID $CLSID_clsStringBuilder LIB "rc6.dll"

TXT.WINDOW("RC6 clsStringBuilder",10,20,25,80) TO hWin

IF ISOBJECT(RC6) THEN TXT.PRINT "Created" 'AddNL should Add A NewLine, ' but it does not Add A NewLine theVar = UCODE$("One") : OBJECT CALL RC6.AddNL(theVar) theVar = UCODE$("Two") : OBJECT CALL RC6.AddNL(theVar) theVar = UCODE$("Three") : OBJECT CALL RC6.AddNL(theVar) OBJECT GET RC6.ToString TO theVar 'Output is not printed with a New Line, ' as it did with VBScript TXT.PRINT theVar TXT.PRINT ACODE$(theVar) 'DIM theVar AS String <-- Is String how theVar should be DIMmed? ELSE TXT.PRINT "Not Created" END IF

TXT.WAITKEY$ END FUNCTION

Constructive comments appreciated.

vbRichClient RC6 Ref: https://www.vbrichclient.com/en/Downloads.htm
vbRichClient RC6 Ref: https://www.vbforums.com/showthread....s-Docs-UPDATED
vbRichClient RC6 Ref: https://www.vbforums.com/showthread....ectCOM-amp-RC6

Joe