我用的 这个函数 SetLibraryList
Description
Changes the files in the library search path of the application.
Controls
Application object
Syntax
applicationname.SetLibraryList ( filelist )
Argument Description
applicationname The name of the application object for which you want to change the library search path
filelist A comma-separated list of filenames. Specify the full filename with its extension. If you do not specify a path, PowerBuilder uses the system's search path to find the file
Return value
Integer. Returns 1 if it succeeds. If an error occurs, it returns:
-1 The application is being run from PowerBuilder, rather than from a standalone executable.
-2 A currently instantiated object is in a library that is not on the new list.
If any argument's value is NULL, SetLibraryList returns NULL.
Usage
When your application needs to load an object, PowerBuilder searches for the object first in the executable file and then in the dynamic libraries specified for the application. You can specify a different list of library files from those specified in the executable with SetLibraryList. Calling SetLibraryList replaces the list of library files specified in the executable with a new list of files. For example, you might use SetLibraryList to configure the library list for an application containing many subsystems.
SetLibraryList should only be called in your application's Open event script. Otherwise, it may cause your application to crash.
PowerBuilder cannot check whether the libraries you specify are appropriate for the application. It is up to you to make sure the libraries contain the objects that the application needs.
The executable file is always first in the library search path. If you include it in filelist, it is ignored.
If you are running your application in the PowerBuilder development environment, this function has no effect.
不过编译后运行时,返回值是 -2 ,也没有找出原因是什么?
ll=finance.SetLibraryList("finance.pbd,aaa.pbd,temp.pbl) 这里面我加了个 temp.pbl, 然后我的思路是,
先动态生成全部数据窗口,估计有几十个,通过LibraryImport() 保存到 temp.pbl 这部分功能都能顺利实现,
现在就是 把这些数据窗口,动态生成 复合数据窗口 的过程中,编译后的程序无法读取到 temp.pbl 中的数据窗口。不知道
是不是因为SetLibraryList() 这个函数执行不成功的原因, 是不是里面不能添加 pbl, 不过我都改成 pbd, 还是出错,返回值 还
是 -2, 搞不懂是什么原因, 多谢您的回复!!! |