I am trying to use a function from an API that uses containers. Here is the documentation on the function.
Syntax GMW_NV_GetValue( , , ) Parameters hgmnv is the pointer to a valid name value container Name is the name of the value to return Default is the default value if is null or does not exist. Example sValue := GMW_NV_GetValue(pGMNV, ‘Phone1’, ‘(none)’);
In CVI I don't know how to use the "sValue". I think that I have the rest of the parms OK. What do I do?
I have a few questions for you so I can pinpoint what the problem might be: What is the GMW_NV_GetValue returning? Is it just the status of the function (whether it succeeded or failed) or is it the value the function gets? What type is the return value? What exactly are you trying to do with this function call, and how do you plan to use the sValue after you assign a value to it?
What sValue actaully is would probably be better reflected in the documentation of the container that you are using. CVI just imports the activex interfaces that are exposed. The CVI generated wrappers always return an HRESULT to indicate an error or sucess. If sValue was some object, it might have be one of the function parameters in the CVI wrappers. So its use might look a little different in CVI.
and I stepped through with the debugger. The create works fine since ptrNv returns OK. The GMW_Execute is OK since iRc returns a retrun code of 1. GMW_NV_GetValue() goes out and after it runs I take a look at ptrNv. It has the same value as before I call it. I took a look at the memory location pointed at but it wasn't filled in with data. Any ideas on what to do?
Does ptrNv point to the object created by GMW_NV_Create()? If so then I think GMW_NV_GetValue(ptrNv,"Phone1","none"); would return a value or a different pointer to the returned value rather than changing the value of the object pointed to by ptrNv. To put this in a simpler way: Is the GMW_NV_GetValue() function supposed to change the value of the object pointed by ptrNV?
Did Wendy's suggestion of declaring pszVal as a const char* instead of a char* work?