LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

scan specified directory

hi,

my problem is, that I must scan a specified directory and get some sub-directorys, to put them into a list. I can´t use some dialog-boxes, the list must fill automatic. It is a part of an biger CVI application, that I must use CVI.
I hope someone can help me.
0 Kudos
Message 1 of 4
(3,086 Views)
Have you looked into GetFirstFile() and GetNextFile() functions? They are in the Utility library. You can use these to search for directories or files within a directory that you specify.

Is this what you need?
0 Kudos
Message 2 of 4
(3,086 Views)
Hello

you would need to look into the win32 api to make your own custom panel for this. CVI will install the libraries for the SDK so you have everything you would need. Try the shell functions like SHGetFileInfo(), you can get help on them from the MSDN.
Also , this link might provide some information.

I hope this helps

Thanks

Bilal Durrani
NI
Bilal Durrani
NI
Message 3 of 4
(3,086 Views)
THX for helping,

I have find a reason for my Problem. To help other one I put the Source in this comment:

void scanForDirectory(char *root)
{
WIN32_FIND_DATA FD0;
HANDLE hFind0;
char pfad[MAX_PATH];
char pfad0[MAX_PATH];

char *test;
int k;
TProject akt_Project;


Fmt(pfad0,"%s<%s", root); //benutzt das root-directory um suchstring zu generieren
Fmt(pfad,"%s<%s\\*.*", pfad0);
hFind0 = FindFirstFile(pfad,&FD0); //sucht nach Inhalt des directories und schreibt es in Liste
while (hFind0 != INVALID_HANDLE_VALUE) //schleife für jeden gültigen Eintrag der gefundenen Liste
{
if (((FD0.dwFileAttributes) & !FILE_ATTRIBUTE_DIRECTORY)==0) //ist es ein verzeichnis?
{
test = FD0.cFileName; //test, ob es sich nicht um einen
"." oder ".." handelt, da sonst
k = CompareStrings (".", 0, test, 0, 0); //die ganze HD durchsucht wird
if(k !=0)
{
k = CompareStrings ("..", 0, test, 0, 0);
if(k !=0)
{

//CODE

};
};
};
if (!FindNextFile(hFind0,&FD0)) break; //sucht nächsten Eintrag
};

FindClose(hFind0);
};
0 Kudos
Message 4 of 4
(3,086 Views)