home *** CD-ROM | disk | FTP | other *** search
- #define INCL_WIN
- #define INCL_GPI
- #define INCL_DOS
- #define INCL_VIO
- #define INCL_AVIO
- #include <os2.h>
- #include <mt\stdio.h>
- #include <mt\stdlib.h>
- #include <mt\string.h>
- #include "aw.h"
-
- extern HWND hwndaw;
-
- extern char far filename[20];
- extern USHORT all;
- extern char drive_str[27][4];
- extern USHORT num_drive;
- extern LONG SecSem;
- extern USHORT busy;
- extern USHORT file_attr;
- char far pathname[180];
-
- VOID FAR SecondThread()
- {
- USHORT indx;
-
- while(1)
- {
- DosSemWait(&SecSem,-1L);
- busy = TRUE;
- for(indx= 0; indx < num_drive;indx++)
- {
- find_dir(drive_str[indx]);
- }
- WinPostMsg(hwndaw,WM_PAINT_TTY,"File search complete !!",0L);
- WinAlarm(HWND_DESKTOP,WA_NOTE);
- busy = FALSE;
- DosSemSet(&SecSem);
- }
- }
-
- VOID find_dir(path)
- char *path;
- {
- char localpath[180];
- FILEFINDBUF buff;
- USHORT count;
- USHORT handle;
-
- strcat(path,"\\");
- strcpy(localpath,path);
- strcat(localpath,"*.*");
- handle = 0xFFFF;
- count = 1;
- if(DosFindFirst(localpath,&handle,0x0010,&buff,sizeof(buff),&count,0L))
- {
- DosFindClose(handle);
- search_dir(path);
- return;
- }
- if(buff.achName[0] != '.' && (buff.attrFile & 0x0010))
- {
- strcpy(localpath,path);
- strcat(localpath,buff.achName);
- find_dir(localpath);
- }
- while(TRUE)
- {
- if(DosFindNext(handle,&buff,sizeof(buff),&count))
- {
- DosFindClose(handle);
- search_dir(path);
- return;
- }
- if(buff.achName[0] != '.' && (buff.attrFile & 0x0010))
- {
- strcpy(localpath,path);
- strcat(localpath,buff.achName);
- find_dir(localpath);
- }
- }
- }
-
- VOID search_dir(path)
- char *path;
- {
- char localpath[180];
- FILEFINDBUF buff;
- USHORT count;
- USHORT handle;
-
- strcpy(localpath,path);
- strcat(localpath,filename);
- strset(buff.achName,0);
- handle = 0xFFFF;
- count = 1;
- if(DosFindFirst(localpath,&handle,file_attr,&buff,sizeof(buff),&count,0L))
- {
- DosFindClose(handle);
- return;
- }
- if(all || (buff.attrFile & file_attr))
- {
- DosSemWait(&SecSem,-1L);
- sprintf(pathname,"%s%s",path,buff.achName);
- DosSemSet(&SecSem);
- WinPostMsg(hwndaw,WM_PAINT_TTY,pathname,0L);
- }
- while(TRUE)
- {
- if(DosFindNext(handle,&buff,sizeof(buff),&count))
- {
- DosFindClose(handle);
- return;
- }
- DosSemWait(&SecSem,-1L);
- if(all || (buff.attrFile & file_attr))
- {
- sprintf(pathname,"%s%s",path,buff.achName);
- DosSemSet(&SecSem);
- WinPostMsg(hwndaw,WM_PAINT_TTY,pathname,0L);
- }
- }
- }
-
- VOID EnableMenuItem(HWND hwnd, SHORT iMenuItem, BOOL bEnable)
- {
- HWND hwndParent;
- HWND hwndMenu;
-
- hwndParent = WinQueryWindow(hwnd,QW_PARENT,FALSE);
- hwndMenu = WinWindowFromID(hwndParent,FID_MENU);
-
- WinSendMsg(hwndMenu,MM_SETITEMATTR,(MPARAM)MAKEULONG(iMenuItem,TRUE),
- (MPARAM)MAKEULONG(MIA_DISABLED,bEnable ? 0 : MIA_DISABLED));
- }