LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

what is a sValue?

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?
0 Kudos
Message 1 of 7
(4,401 Views)
Hello,

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?


Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 2 of 7
(4,369 Views)
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.

Hope this helps
Bilal Durrani
NI
0 Kudos
Message 3 of 7
(4,341 Views)
Well here is the def from the include file:

const char* __stdcall GMW_NV_GetValue(HGMNV hgmnv, const char* name, const char* defaultValue);

How do I call this? I tried:

char *pszVal;
pszVal=GMW_NV_GetValue(ptrNv,"Phone1","none");

But I got this error: 80, 50 Operands of = have illegal types 'pointer to char' and 'pointer to
const char'.

So what type should pszVal be?
0 Kudos
Message 4 of 7
(4,334 Views)
Hello,

Have you tried just calling the function without assigning the return value to a variable. As in:

...
GMW_NV_GetValue(ptrNv,"Phone1","none");
...

Or you can try defining your pszVal as a const char* instead of a char*.


Thanks.
Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 5 of 7
(4,320 Views)
OK. I tried this code:

ptrNv=GMW_NV_Create();
iRc=GMW_Execute("GetUsersList",ptrNv);
GMW_NV_GetValue(ptrNv,"Phone1","none");

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?
0 Kudos
Message 6 of 7
(4,273 Views)
Hi,

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?

Regards,
Prashanth V
National Instuments
0 Kudos
Message 7 of 7
(4,257 Views)