[Migrated content. Thread originally posted on 13 June 2005]
I try to do a kind of "c$listdir" with Activx.So i have a wsh.def and these lines:
01 wsh-filesyst-handle handle of @FileSystemObject.
01 wsh-folder-handle handle of @Folder.
01 wsh-col-folder-handle handle of IFolderCollection.
01 wsh-col-file-handle handle of IFileCollection.
01 wsh-file-handle handle of @File.
01 file-anz pic 9(06).
01 file-z pic 9(06).
create @FileSystemObject of IWshRuntimeLibrary
handle in wsh-filesyst-handle.
modify wsh-filesyst-handle, @GetFolder(my-folder)
giving wsh-folder-handle.
inquire wsh-folder-handle, @Files()
wsh-col-file-handle.
** And now i try to access each file (maybe the index has to start with zero, but can't test it yet):
inquire wsh-col-file-handle, @count File-anz.
move 1 to file-z.
perform varying file-z from 1 by 1 until file-z >= file-anz
*P* inquire wsh-col-file-handle, @item(by name key file-z)
in wsh-file-handle
inquire wsh-file-handle, @name datei-name
destroy wsh-file-handle
end-perform.
At the line marked with *P* i get an error "invalid Parameter".
I tried allready to use the "c$setvariant" to translate file-z into a variant, but no changes. there are 8 files in the directory and the @count shows up the right count, so that can not be the problem.
The definition of the @item is:
PROPERTY-GET, 0, @Item,
"VARIANT" @Key, TYPE 12
RETURNING "IFile*", TYPE 9
I can't find the problem. Does anyone have an idea?
i need with program, because the "c$listdir" dont work for local files on thinclients.