does the oleobject in pb have defined the method open(ref string)? - powerbuilder

I got the error
Error calling external object function open at line "hObj.Open(ref sOut)"
when I run those code in PowerBuilder 11.5, here is the code:
string sOut
hObj.Open(ref sOut)
oleobject objXMLDOM
objXMLDOM = GetXmlDom(sOut)
Boolean bRet
bRet = CheckOutputState(objXMLDOM)
This code is from a function. The param is (ref oleobject hobj)
I have these questions:
What's the use of string sOut? When i run this program, string sOut is null, and occurs an null reference error.
Does the system defined the method open(ref string) already? But when I search the documentation of pb, I haven't find this method was defined, can any one give me some direction, thanks.

All the function calls must be preceeded by object. For example object.Open.


What is the reference type for Node-FFI for a c++ file pointer?

I can't figure out which 'ref' module type to use in this situation.
I have a DLL function that returns a bool and takes a file pointer as a parameter:
__declspec(dllexport) BOOL __stdcall GB_Build( FILE *fname )
{ return Greenhouse.Build(fname) == true ? TRUE : FALSE; }
And a Node-FFI binding:
var ffi = require('ffi');
var ref = require('ref');
var greenbuildlib = null;
greenbuildlib = './PGD/GreenBuild_DLL.dll';
var greenbuild = ffi.Library(greenbuildlib, {
"GB_GetBayLength": ['double', []],
"GB_SetBayLength": ['void', ['double']],
"GB_Build": ['bool', [ref.types.Object]],
module.exports = greenbuild;
The "GB_Build" function creates a json file, and returns a bool based on if the file was created or not. fname stands for "file name" and is a C++ nullptr in the C++ code within the DLL.
I am wondering what the ref.type would be to properly pass a file pointer in Node-FFI. I've tried null pointers, null, string, and Object, but all of them crash the application when I try this in the client-code:
var file_name = "test.json";
Thank you for any help. I couldn't find another question on stackoverflow about file pointers in Node-FFI.
For anybody else with this problem, since this question got no responses, the answer seems to be that Node-FFI does not have a file pointer at all. You must change the source code for C or C++ to use char * instead.

Input Method Manager Functions - correct call order for Hiragana to Kanji candidates list c++ covnersion

I'm trying to convert the Hiaragana characters to candidates list (Kanji). Looks like it should be possible by using the Input Method Manager Functions but it doesn't work as I expected.
I installed the Japanese Language pack and I'm able to open IME in the text editor so some functionalities should be enabled.
In src we have sth like:
HIMC context = ImmCreateContext();//non-NULL result
bool result = ImmSetOpenStatus(context, true);//result == true
std::wstring wstr = L"こいび";//Hiragana string for conversion
result = ImmSetConversionStatus(context, IME_CMODE_JAPANESE, IME_SMODE_NONE);//result == true
result = ImmSetCompositionString(context, SCS_SETSTR, (LPVOID)wstr.c_str(), wstr.length(), NULL, 0);//result == true
DWORD listCount = 0;
DWORD lpdResult = 0;
lpdResult = ImmGetCandidateListCount(context, &listCount);//listCount == 0, lpdResult == 144
Looks like it works somehow but I'm always getting similar results (I checked it for standard letters, shorter JPN string and by creating std::string + conversion to wstring).
Unfortunately I didn't found example related to it so maybe I didn't call something or I called something in wrong order.
The MS documentation contains not too much details about it so I'm not sure what's wrong.
Imm function must use in window message loop.
for example,
look remark part.
"Applications typically call this function in response to an IMN_OPENCANDIDATE or IMN_CHANGECANDIDATE command."
when message loop type is "IMN_OPENCANDIDATE" or "IMN_CHANGECANDIDATE", you can use immgetcandidatelistcount function.

VB .NET function that calls a C++ COM Method that receives variants as outs

I have racked my brain and almost killed my keyboard trying to manage to make this work. Any help would be greatly appreciated.
I am creating a VB .NET app that is a helper app for another system. I have access to the API for the application that I am accessing. Long story short, here is the C++ COM Function that I need to call:
Remote Server = [IN] Dispatch - Object to the connection, Nothing can be used if already connected
ScreenName = [IN] String - Name of the screen to use
FieldData = [IN] Dispatch - Object of the data to be found, Nothing is acceptable
ObjId = [IN] Dispath - Object of the file to be found
Flags = [IN] Long - Always 0, future use
MaxHitCount = [IN] Long - Max number of records to retrieve (0 returns all)
ResultSet = [OUT] Variant - Record Array of the records found
ScreenDef = [OUT] Variant - Screen Definition that describes the screen
OASError = [OUT] Long - Returns 0 if successful or error from server if not
I have access to declare the ResultSet & ScreenDef different ways. My issue is that I keep getting a Type Mismatch error when I attempt to pass the function in this manner:
Dim Optix8 As OptixRemoteServer = New OptixRemoteServer()
Dim Optix8WS As Object = CreateObject("Optix8.Application")
If (Optix8WS.ServerLogon("########")) Then
Dim screen_name = "Claims"
Dim myFieldData As Object = Nothing
Dim myObjectId = CreateObject("Optix8.Objid")
Dim Flags As Long = 0
Dim MaxHitCount As Long = 0
Dim myResultSet As Object = Nothing
Dim myScreenDef As Object = Nothing
Dim OASError = Nothing
Dim result = Optix8WS.RecordSearch(Nothing, screen_name, myFieldData, myObjectId, Flags, MaxHitCount, myResultSet, myScreenDef, OASError)
Catch ex As Exception
End Try
End If
The issue is with the myResultSet & myScreenDef I believe. I don't fully understand how to pass the [out] of those two to the empty objects that are created. I have done this in C# by using out and ref but, those are not feasible in VB.NET.
Am I missing something? How would I accomplish this? I am not very big on VB.NET. I am a C# programmer.

Is there a way to call a class method inside an eval?

I'm writing Groovy scripts that are pasted into a web-based system to be run. There is a
class available to scripts run in this environment which I'll call BrokenClass. It has a
bug where it will only accept a string literal as its first parameter, but not a variable
with a string in it. So, this will work (it returns a list):
BrokenClass.reflist('something', 'name')
However, if I try to use a variable as the first parameter I get an error:
list_name = 'something'
BrokenClass.reflist(list_name, 'name')
This produces the message Metadata RefList[something] cannot be accessed.
I don't have any control over BrokenClass (aside from filing a bug on it). I tried to work
around the problem with something like this:
list_name = "foo"
list_call = "BrokenClass.reflist(${list_name}, 'name')"
list_values =
However, that produces an error:
groovy.lang.MissingPropertyException: No such property: BrokenClass for class: Script1
I tried adding an import to my string, but then I get unable to resolve class BrokenClass.
Is there a way to use BrokenClass inside the eval'd string? Or some other way I haven't
considered to work around the bug in BrokenClass.reflist? A really long switch block
is out, because the possible list names change.
The method signature for BrokenClass.reflist is:
public static List<Object> reflist(String reflistName, String field);
I have a suspicion that BrokenClass.reflist() is directly or indirectly doing an improper String comparison by using the == operator rather than String.equals(). See this article for an explanation of the difference.
The problem
Here's a demonstration of the problem:
def a = 'whatever'
def b = 'what' + 'ever'
assert doSomething('whatever') == 'OK'
assert doSomething(a) == 'OK'
assert doSomething(b) == 'ERROR'
def doSomething(String value) {
if('whatever')) { // In Java this would be: value == "whatever"
} else {
Because it's using reference equality, which in Groovy is done by the method, BrokenClass.reflist() was inadvertently coded to work only with String literals: all String literals with the same value refer to the same String instance, resulting in an evaluation of True. A String composed at run time with the same value of a literal does not refer to the same String instance.
Work around
Obviously BrokenClass.reflist() should be fixed. But you can work around the problem by using an interned String.
def b = 'what' + 'ever'
assert doSomething(b.intern()) == 'OK'
def doSomething(String value) {
if('whatever')) {
} else {
If the variable's value matches that of a String literal, then variable.intern() will return the same String instance as the matching literal. This would allow the Java == operator to work as you need it to.

Look for header variables using OleFunction “find” inside of an Excel template and replace them from C++

My problem is the following:
I open an Excel - File and I don't know which of the possible header-variables my clients have used in the template file. These can be: #DATE, #TIME, #NAME and so on. So I need to look for these variables and if the have been used: Replace them.
vCell = findCell("DATE");
tempStr = DateToStr(Date()) ; // Date
if (vCell.VType != VT_EMPTY )
vWorksheet.OlePropertyGet("Cells", vCell.OlePropertyGet("Address")).OlePropertySet("Value",StringToOleStr(tempStr));
findCell looks like this:
Variant __fastcall TClassExcel::findCell(AnsiString Cell,String Range){
// Range is set to A1:Z100 as default in the header file
vRange = vWorksheet.OlePropertyGet("Range",StringToOleStr(Range));
return vRange.OleFunction("Find", StringToOleStr("#"+Cell));
The line if (vCell.VType != VT_EMPTY) does not detect if there is no such cell inside of the header. I also tried vCell.Empty() and it did not work out. Vtype = 9 if I watch the value. So, I am looking for the corresponding "If Not cell Is Nothing Then" of VBA
This reference is to the MSDN library to the find method: MSDN Find Method to be sure to NOT try to write some Variables into a Cell that does not exist.
Have you tried : if (vCell != "") or if (vCell.strVal != "") ?
In some cases the apparently empty cell returns an empty string and so is detected as being non-empty.
(P.S. I have no experience with the C++ to Excel OLE interface so use whatever member variable/function of vCell that returns its String value)