快速登录:  

Forum: VirtualDJ 8.1 Technical Support

话题: API Question: GetStringInfo() function crashes VDJ

由于该帖子已年深日久,可能包含陈旧过时或描述错误的信息。

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!
 

发表时间 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)
 

发表时间 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)


 

发表时间 Fri 12 Feb 16 @ 2:07 pm


(陈旧帖子或论坛版块会自动关闭)