Quick Sign In:  

Forum: VirtualDJ 8.1 Technical Support

Topic: API Question: GetStringInfo() function crashes VDJ

This topic is old and might contain outdated or incorrect information.

Hello, I have VirtualDJ 8.1 PC vuild 2832.1112 and I am trying to build a plugin in Microsoft VC++, and I am running into some problems using the GetStringInfo() function referenced in the C++ header file.

My code is as follows:

char *temp_filepath = "";
hr = GetStringInfo("get_version", temp_filepath, 100);

I would like to use the plugin to get string data from VDJ, but every time I run a command, even a simple one like "get_version" VirtualDJ crashes and relaunches, and I can find no error debugging information. I can use GetInfo() to retrieve a numeric value successfully, I haven't been able to find out how to get string data out of the program.

The vdjPlugin8.h file lists this definition I am trying to use:
// get info from VirtualDJ (as a value, or as a utf-8 string)
HRESULT GetInfo(const char *command, double *result) {return cb->GetInfo(command,result);}
HRESULT GetStringInfo(const char *command, char *result, int size) {return cb->GetStringInfo(command,result,size);}

What does "size" do? Any help getting this working would be greatly appreciated. Thanks!
 

Posted Fri 12 Feb 16 @ 3:41 am
AdionPRO InfinityCTOMember since 2006
It is up to you to supply memory for the function to read into.
So you should first get some memory:
char temp_filepath[100];
And then you can use it in GetStringInfo as you did.
The 100 is the size of the buffer you supplied (in this case 100 bytes)
 

Posted Fri 12 Feb 16 @ 6:23 am
Makes sense now, it works perfectly, thanks for the tip. ☺

Adion wrote :
It is up to you to supply memory for the function to read into.
So you should first get some memory:
char temp_filepath[100];
And then you can use it in GetStringInfo as you did.
The 100 is the size of the buffer you supplied (in this case 100 bytes)


 

Posted Fri 12 Feb 16 @ 2:07 pm


(Old topics and forums are automatically closed)