我正在为 Adobe Acrobat 编写一个插件,并且在设置 AVAppOpenDialog
变量的对话实现时遇到一些问题
*outASPathNames
在底部的代码中。它在方法中说这个变量是一个
ASPathName**
这是我的设置方法。即使该文件名为 file.jpg,它有时也会显示不同的名称,例如 A9R5D8F.tmp 或根本不起作用。我怀疑我没有正确设置变量,但是当您没有被告知问题所在时,黑盒测试非常困难。谁能从下面的代码中看出我可能做错了什么
ASPathName asPathName;
char *filePath = "C:\\Test\\file1.jpg";
ASFile asFile;
ASPathName* arrays[] = {&asPathName};
asPathName = ASFileSysCreatePathFromDIPath(0, filePath, 0);
ASFileSysOpenFile64(0, asPathName, ASFILE_READ, (ASFile *)&asFile);
*outASPathNames = &asPathName;
最佳答案
`*outASPathNames`
根据 Acrobat API,它是一个路径名数组。因此,对于初学者来说,您需要使用数组而不是 ASPathName 的地址。
其次,您需要确保分配此数组内存,否则会抛出异常。这里的1是数组的大小。
*outASPathNames = (ASPathName*)ASmalloc(sizeof(ASPathName) * 1);
然后就可以填充
**outASPathNames = asPathName
关于plugins - 设置 Acrobat Dialogue 返回值的 ASPathNames,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15635344/