Changeset 91 for trunk/dll/dirsize.c
- Timestamp:
- May 21, 2004, 5:16:05 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/dirsize.c
r54 r91 4 4 $Id$ 5 5 6 Directory size 6 Directory sizes 7 7 8 8 Copyright (c) 1993-98 M. Kimes … … 11 11 Revisions 16 Oct 02 SHL - Handle large partitions 12 12 12 Feb 03 SHL - Use CBLIST_TO_EASIZE 13 21 Nov 03 SHL - Avoid VAC \ after // bug (wierd) 14 21 Nov 03 SHL - Correct minor typos 15 21 Nov 03 SHL - Total drives >4GB better 13 16 14 17 ***********************************************************************/ … … 27 30 #include "fm3str.h" 28 31 29 #pragma alloc_text(DIRSIZE,ProcessDir,FillCnr s,DirSizeProc)32 #pragma alloc_text(DIRSIZE,ProcessDir,FillCnrThread,DirSizeProc) 30 33 #pragma alloc_text(DIRSIZE2,PrintToFile,FillInRecSizes,SortSizeCnr) 31 34 32 35 typedef struct { 33 CHAR * filename;36 CHAR *pszFileName; 34 37 HWND hwndCnr; 35 CHAR * stopflag;36 DIRCNRDATA * dcd;38 CHAR *pchStopFlag; 39 DIRCNRDATA *pDCD; 37 40 } DIRSIZE; 38 41 39 42 typedef struct { 40 43 CHAR dirname[CCHMAXPATH]; 41 CHAR stopflag;44 CHAR pchStopFlag; 42 45 BOOL dying; 43 46 BOOL working; … … 46 49 47 50 48 SHORT APIENTRY SortSizeCnr (PMINIRECORDCORE p1,PMINIRECORDCORE p2,49 PVOID SortFlags) { 50 51 static SHORT APIENTRY SortSizeCnr (PMINIRECORDCORE p1,PMINIRECORDCORE p2, 52 PVOID SortFlags) 53 { 51 54 ULONG size1,size2; 52 55 … … 57 60 58 61 59 static ULONG ProcessDir (HWND hwndCnr,CHAR * filename,PCNRITEM pciParent,60 CHAR *stopflag,BOOL top)62 static ULONG ProcessDir (HWND hwndCnr,CHAR *pszFileName,PCNRITEM pciParent, 63 CHAR *pchStopFlag,BOOL top, BOOL *pfIsKB) 61 64 { 62 CHAR maskstr[CCHMAXPATH],*pEndMask; 63 register char *p,*sp,*pp; 64 ULONG nm,totalbytes = 0L,subbytes = 0L,temp; 65 CHAR maskstr[CCHMAXPATH]; 66 CHAR *pEndMask; 67 register char *p; 68 register char *sp; 69 register char *pp; 70 ULONG nm; 71 ULONG ulCurDirKB = 0L; 72 ULONG ulCurDirBytes = 0L; 73 ULONG ulSubDirKB = 0L; 74 ULONG ulSubDirBytes = 0L; 75 ULONG ulTotal; 65 76 HDIR hdir; 66 FILEFINDBUF4 *ffb;77 FILEFINDBUF4 *pFFB; 67 78 APIRET rc; 68 79 RECORDINSERT ri; 69 PCNRITEM p ciP;70 71 ffb= malloc(sizeof(FILEFINDBUF4) /* * FilesToGet */);72 if(! ffb)80 PCNRITEM pCI; 81 82 pFFB = malloc(sizeof(FILEFINDBUF4) /* * FilesToGet */); 83 if(!pFFB) 73 84 return -1L; 74 strcpy(maskstr, filename);85 strcpy(maskstr,pszFileName); 75 86 if(maskstr[strlen(maskstr) - 1] != '\\') 76 87 strcat(maskstr,"\\"); 77 pEndMask = &maskstr[strlen(maskstr)]; // Point after last \88 pEndMask = &maskstr[strlen(maskstr)]; // Point after last backslash 78 89 strcat(maskstr,"*"); 79 //printf("%s\n",maskstr); 90 //printf("%s\n",maskstr); 91 80 92 hdir = HDIR_CREATE; 81 93 nm = 1L; 82 memset( ffb,0,sizeof(ffb));94 memset(pFFB,0,sizeof(FILEFINDBUF4)); 83 95 DosError(FERR_DISABLEHARDERR); 84 //printf("FIND1\n"); 85 rc = DosFindFirst(filename, &hdir, 86 FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED | 87 FILE_SYSTEM | FILE_HIDDEN | MUST_HAVE_DIRECTORY, 88 ffb, sizeof(FILEFINDBUF4),&nm, FIL_QUERYEASIZE); 96 //printf("FIND1\n"); 97 rc = DosFindFirst(pszFileName, &hdir, 98 FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED | 99 FILE_SYSTEM | FILE_HIDDEN | MUST_HAVE_DIRECTORY, 100 pFFB, sizeof(FILEFINDBUF4),&nm, FIL_QUERYEASIZE); 101 89 102 if(!rc) 90 103 DosFindClose(hdir); 91 104 92 105 /* 93 * the "|| strlen( filename) < 4 below works around an OS/2 bug106 * the "|| strlen(pszFileName) < 4 below works around an OS/2 bug 94 107 * that prevents FAT root directories from being found when 95 108 * requesting EASIZE. sheesh. 96 109 */ 97 if((!rc && ( ffb->attrFile & FILE_DIRECTORY)) || strlen(filename) < 4)110 if((!rc && (pFFB->attrFile & FILE_DIRECTORY)) || strlen(pszFileName) < 4) 98 111 { 99 if(* stopflag) {100 free( ffb);112 if(*pchStopFlag) { 113 free(pFFB); 101 114 return -1L; 102 115 } 103 116 //printf("CM_ALLOCRECORD\n"); 104 p ciP= WinSendMsg(hwndCnr,CM_ALLOCRECORD,MPFROMLONG(EXTRA_RECORD_BYTES2),105 106 if(!p ciP) {107 free( ffb);117 pCI = WinSendMsg(hwndCnr,CM_ALLOCRECORD,MPFROMLONG(EXTRA_RECORD_BYTES2), 118 MPFROMLONG(1L)); 119 if(!pCI) { 120 free(pFFB); 108 121 return -1L; 109 122 } 110 if(!rc) 111 totalbytes = ffb->cbFile + CBLIST_TO_EASIZE(ffb->cbList); 123 if(!rc) { 124 ulCurDirKB = pFFB->cbFile >> 10; 125 ulCurDirBytes = pFFB->cbFile & 0x3ff; 126 ulCurDirKB += CBLIST_TO_EASIZE(pFFB->cbList) >> 10; 127 ulCurDirBytes += CBLIST_TO_EASIZE(pFFB->cbList) & 0x3ff; 128 } 112 129 else 113 130 DosError(FERR_DISABLEHARDERR); 114 p ciP->pszLongname = pciP->szFileName;115 p ciP->rc.hptrIcon = hptrDir;116 *p ciP->szDispAttr = *pciP->Longname = *pciP->subject = 0;117 p ciP->attrFile = 0L;131 pCI->pszLongname = pCI->szFileName; 132 pCI->rc.hptrIcon = hptrDir; 133 *pCI->szDispAttr = *pCI->Longname = *pCI->subject = 0; 134 pCI->attrFile = 0L; 118 135 } 119 136 else 120 137 { 121 free( ffb);138 free(pFFB); 122 139 Dos_Error(MB_ENTER, 123 124 125 126 127 128 filename);140 rc, 141 HWND_DESKTOP, 142 __FILE__, 143 __LINE__, 144 GetPString(IDS_CANTFINDDIRTEXT), 145 pszFileName); 129 146 return -1L; 130 147 } 131 148 132 if(strlen( filename) < 4 || top)133 strcpy(p ciP->szFileName,filename);149 if(strlen(pszFileName) < 4 || top) 150 strcpy(pCI->szFileName,pszFileName); 134 151 else { 135 p = strrchr( filename,'\\');152 p = strrchr(pszFileName,'\\'); 136 153 if(!p) 137 p = filename;154 p = pszFileName; 138 155 else 139 156 p++; 140 sp = (strchr( filename,' ') != NULL) ? "\"" : NullStr;141 pp = p ciP->szFileName;157 sp = (strchr(pszFileName,' ') != NULL) ? "\"" : NullStr; 158 pp = pCI->szFileName; 142 159 if(*sp) { 143 160 *pp = *sp; … … 149 166 strcat(pp,sp); 150 167 } 151 p ciP->pszFileName = pciP->szFileName + strlen(pciP->szFileName);152 p ciP->rc.pszIcon = pciP->pszLongname;153 p ciP->rc.flRecordAttr |= CRA_RECORDREADONLY;168 pCI->pszFileName = pCI->szFileName + strlen(pCI->szFileName); 169 pCI->rc.pszIcon = pCI->pszLongname; 170 pCI->rc.flRecordAttr |= CRA_RECORDREADONLY; 154 171 if(fForceUpper) 155 strupr(p ciP->szFileName);172 strupr(pCI->szFileName); 156 173 else if(fForceLower) 157 strlwr(p ciP->szFileName);174 strlwr(pCI->szFileName); 158 175 memset(&ri,0,sizeof(RECORDINSERT)); 159 176 ri.cb = sizeof(RECORDINSERT); … … 163 180 ri.cRecordsInsert = 1L; 164 181 ri.fInvalidateRecord = TRUE; 165 //printf("CM_INSERTRECORD\n");166 if(!WinSendMsg(hwndCnr,CM_INSERTRECORD,MPFROMP(p ciP),MPFROMP(&ri))) {167 //printf("Insert failed\n");168 free( ffb);182 //printf("CM_INSERTRECORD\n"); 183 if(!WinSendMsg(hwndCnr,CM_INSERTRECORD,MPFROMP(pCI),MPFROMP(&ri))) { 184 //printf("Insert failed\n"); 185 free(pFFB); 169 186 return -1L; 170 187 } 171 188 hdir = HDIR_CREATE; 172 189 nm = 1L; 173 //printf("FIND2\n");190 //printf("FIND2\n"); 174 191 rc = DosFindFirst(maskstr,&hdir, 175 176 177 ffb,178 179 192 FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED | 193 FILE_SYSTEM | FILE_HIDDEN | FILE_DIRECTORY, 194 pFFB, 195 sizeof(FILEFINDBUF4), 196 &nm, 180 197 FIL_QUERYEASIZE); 181 198 if(!rc) 182 199 { 183 register PBYTE fb = (PBYTE) ffb;200 register PBYTE fb = (PBYTE)pFFB; 184 201 FILEFINDBUF4 *pffbFile; 185 202 ULONG x; … … 191 208 for(x = 0L;x < nm;x++) 192 209 { 193 194 195 210 pffbFile = (FILEFINDBUF4 *)fb; 211 //printf("%s\n",pffbFile->achName); 212 //fflush(stdout); 196 213 // Total size skipping . and .. 197 214 if((*pffbFile->achName != '.' || 198 215 (pffbFile->achName[1] && pffbFile->achName[1] != '.')) || 199 !(pffbFile->attrFile & FILE_DIRECTORY)) 200 { 201 totalbytes += pffbFile->cbFile + 202 CBLIST_TO_EASIZE(pffbFile->cbList); 203 if(!(pffbFile->attrFile & FILE_DIRECTORY)) 204 pciP->attrFile++; // Bump file count 205 if(*stopflag) 206 break; 207 if(pffbFile->attrFile & FILE_DIRECTORY) { 216 !(pffbFile->attrFile & FILE_DIRECTORY)) 217 { 218 ulCurDirKB += pffbFile->cbFile >> 10; 219 ulCurDirBytes += pffbFile->cbFile & 0x3ff; 220 ulCurDirKB += CBLIST_TO_EASIZE(pffbFile->cbList) >> 10; 221 ulCurDirBytes += CBLIST_TO_EASIZE(pffbFile->cbList) & 0x3ff; 222 223 if(!(pffbFile->attrFile & FILE_DIRECTORY)) 224 pCI->attrFile++; // Bump file count 225 if(*pchStopFlag) 226 break; 227 if(pffbFile->attrFile & FILE_DIRECTORY) { 208 228 // Recurse into subdir 209 210 if(!*stopflag)229 strcpy(pEndMask,pffbFile->achName); // Append dirname to base dirname 230 if(!*pchStopFlag) 211 231 { 212 temp = ProcessDir(hwndCnr,maskstr,pciP,stopflag,FALSE); 213 if(temp != (ULONG)-1L) 214 subbytes += temp; 232 BOOL fIsKB; 233 ulTotal = ProcessDir(hwndCnr,maskstr,pCI,pchStopFlag,FALSE, &fIsKB); 234 if(ulTotal != (ULONG)-1L) { 235 if (fIsKB) 236 ulSubDirKB += ulTotal; 237 else { 238 ulSubDirKB += (ulTotal >> 10); 239 // Assume we can delay propagating to KB 240 ulSubDirBytes += (ulTotal & 0x3ff); 241 } 242 } 215 243 } 216 217 218 219 220 244 } 245 } 246 if(!pffbFile->oNextEntryOffset) 247 break; 248 fb += pffbFile->oNextEntryOffset; 221 249 } // for matches 222 if(* stopflag)223 250 if(*pchStopFlag) 251 break; 224 252 DosSleep(0L); 225 nm = 1L; /* FilesToGet */ 226 rc = DosFindNext(hdir, ffb,sizeof(FILEFINDBUF4) ,&nm);253 nm = 1L; /* FilesToGet */ 254 rc = DosFindNext(hdir,pFFB,sizeof(FILEFINDBUF4) ,&nm); 227 255 } // while more found 228 256 DosFindClose(hdir); 229 257 priority_normal(); 230 258 } 231 pciP->cbFile = totalbytes; 232 pciP->easize = subbytes; 233 WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPFROMP(&pciP), 234 MPFROM2SHORT(1,CMA_ERASE | CMA_TEXTCHANGED)); 235 free(ffb); 236 return totalbytes + subbytes; 259 260 free(pFFB); 261 262 // Propage carry 263 ulCurDirKB += ulCurDirBytes >> 10; 264 ulCurDirBytes &= 0x3ff; 265 if (ulCurDirBytes) 266 ulCurDirKB++; 267 268 ulSubDirKB += ulSubDirBytes >> 10; 269 ulSubDirBytes &= 0x3ff; 270 if (ulSubDirBytes) 271 ulSubDirKB++; 272 273 pCI->cbFile = ulCurDirKB; 274 pCI->easize = ulSubDirKB; 275 WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPFROMP(&pCI), 276 MPFROM2SHORT(1,CMA_ERASE | CMA_TEXTCHANGED)); 277 278 ulTotal = ulCurDirKB + ulSubDirKB 279 + (ulCurDirBytes >> 10) + (ulSubDirBytes >> 10); 280 if (ulTotal >= 1L << 21) { 281 *pfIsKB = TRUE; 282 } 283 else { 284 *pfIsKB = FALSE; 285 ulTotal = (ulCurDirKB << 10) + (ulSubDirKB << 10) 286 + ulCurDirBytes + ulSubDirBytes; 287 } 288 289 return ulTotal; 237 290 } 238 291 239 292 240 VOID FillInRecSizes (HWND hwndCnr,PCNRITEM pciParent,ULONG totalbytes,241 CHAR *stopflag,BOOL isroot)293 static VOID FillInRecSizes (HWND hwndCnr,PCNRITEM pciParent,ULONG ulTotalKB, 294 CHAR *pchStopFlag,BOOL isroot) 242 295 { 243 PCNRITEM p ci= pciParent;296 PCNRITEM pCI = pciParent; 244 297 SHORT attrib = CMA_FIRSTCHILD; 245 298 246 if(pci) { 247 248 CHAR tf[80],tb[80],tt[80],br[80]; 249 register CHAR *p; 250 register ULONG cntr,x; 251 float cntra = 0.0; 252 253 commafmt(tf,sizeof(tf),(pci->cbFile > 0L && pci->cbFile < 1024L) ? 1L : 254 pci->cbFile / 1024L); 255 *br = 0; 256 if(totalbytes) { 299 if(pCI) { 300 301 float fltPct = 0.0; 302 CHAR szCurDirKB[80]; 303 CHAR szSubDirKB[80]; 304 CHAR szAllDirKB[80]; 305 CHAR szBar[80]; 306 307 // cbFile = currect directory usage in KB 308 // easize = subdirectory usage in KB 309 commafmt(szCurDirKB,sizeof(szCurDirKB),pCI->cbFile); 310 *szBar = 0; 311 312 if(ulTotalKB) { 313 314 register UINT cBar; 315 257 316 if(isroot) { 258 317 259 FSALLOCATE fsa; 260 APIRET rc; 261 262 memset(&fsa,0,sizeof(fsa)); 263 rc = DosQueryFSInfo(toupper(*pci->szFileName) - '@',FSIL_ALLOC,&fsa, 264 sizeof(FSALLOCATE)); 265 if(!rc) 266 cntra = (totalbytes * 100.0) / 267 ((float)fsa.cUnit * (fsa.cSectorUnit * fsa.cbSector)); 268 pci->Longname[1] = 1; 318 FSALLOCATE fsa; 319 APIRET rc; 320 321 memset(&fsa,0,sizeof(fsa)); 322 rc = DosQueryFSInfo(toupper(*pCI->szFileName) - '@',FSIL_ALLOC,&fsa, 323 sizeof(FSALLOCATE)); 324 if(!rc) 325 { 326 fltPct = (ulTotalKB * 100.0) / 327 ((float)fsa.cUnit * (fsa.cSectorUnit * fsa.cbSector) / 1024); 328 } 329 pCI->Longname[1] = 1; // Flag root 269 330 } 270 331 else 271 cntra = (((float)pci->cbFile + pci->easize) * 100.0) / totalbytes; 272 cntr = (ULONG)cntra / 2; 273 p = br; 274 for(x = 0;x < cntr;x++) { 275 *p = '#'; 276 p++; 277 } 278 if(cntr * 2 != (ULONG)cntra) { 279 *p = '='; 280 p++; 281 x++; 282 } 283 for(;x < 50;x++) { 284 *p = ' '; 285 p++; 286 } 287 *p = 0; 332 fltPct = (((float)pCI->cbFile + pCI->easize) * 100.0) / ulTotalKB; 333 334 cBar = (UINT)fltPct / 2; 335 if (cBar) 336 memset(szBar, '#', cBar); 337 if(cBar * 2 != (UINT)fltPct) { 338 szBar[cBar] = '='; 339 cBar++; 340 } 341 if (cBar < 50) 342 memset(szBar + cBar, ' ', 50 - cBar); 343 szBar[50] = 0; 288 344 } 289 pci->flags = (ULONG)cntra; 290 commafmt(tb,sizeof(tb),(pci->easize > 0L && pci->easize < 1024L) ? 1L : 291 pci->easize / 1024L); 292 commafmt(tt,sizeof(tt),(pci->cbFile + pci->easize > 0L && 293 pci->cbFile + pci->easize < 1024L) ? 1L : 294 (pci->cbFile + pci->easize) / 1024L); 295 sprintf(&pci->szFileName[strlen(pci->szFileName)], 296 " %sk + %sk = %sk (%.02lf%%%s)\r%s", 297 tf, 298 tb, 299 tt, 300 cntra, 301 (isroot) ? GetPString(IDS_OFDRIVETEXT) : NullStr, 302 br); 345 346 pCI->flags = (ULONG)fltPct; 347 commafmt(szSubDirKB,sizeof(szSubDirKB),pCI->easize); 348 commafmt(szAllDirKB,sizeof(szAllDirKB),pCI->cbFile + pCI->easize); 349 sprintf(&pCI->szFileName[strlen(pCI->szFileName)], 350 " %sk + %sk = %sk (%.02lf%%%s)\r%s", 351 szCurDirKB, 352 szSubDirKB, 353 szAllDirKB, 354 fltPct, 355 (isroot) ? GetPString(IDS_OFDRIVETEXT) : NullStr, 356 szBar); 303 357 WinSendMsg(hwndCnr, 304 305 MPFROMP(&pci),306 358 CM_INVALIDATERECORD, 359 MPFROMP(&pCI), 360 MPFROM2SHORT(1,0)); 307 361 isroot = FALSE; 308 362 } 309 363 else 310 364 attrib = CMA_FIRST; 311 p ci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pci),312 313 while(p ci && (INT)pci!= -1) {314 if(* stopflag)365 pCI = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pCI), 366 MPFROM2SHORT(attrib,CMA_ITEMORDER)); 367 while(pCI && (INT)pCI != -1) { 368 if(*pchStopFlag) 315 369 break; 316 FillInRecSizes(hwndCnr,p ci,totalbytes,stopflag,isroot);370 FillInRecSizes(hwndCnr,pCI,ulTotalKB,pchStopFlag,isroot); 317 371 isroot = FALSE; 318 p ci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pci),319 372 pCI = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pCI), 373 MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER)); 320 374 } 321 375 } … … 323 377 324 378 static VOID PrintToFile (HWND hwndCnr,ULONG indent,PCNRITEM pciParent, 325 FILE *fp) { 326 379 FILE *fp) 380 { 327 381 PCNRITEM pci; 328 382 register CHAR *p; … … 330 384 if(!pciParent) { 331 385 pciParent = WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(NULL), 332 386 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 333 387 indent = 0; 334 388 } … … 338 392 *p = 0; 339 393 fprintf(fp,"%*.*s%s %lu %s%s\n", 340 341 342 343 344 394 indent * 2,indent * 2," ", 395 pciParent->szFileName, 396 pciParent->attrFile, 397 GetPString(IDS_FILETEXT), 398 &"s"[pciParent->attrFile == 1]); 345 399 if(p) 346 400 *p = '\r'; 347 401 if(pciParent->rc.flRecordAttr & CRA_EXPANDED) { 348 402 pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pciParent), 349 403 MPFROM2SHORT(CMA_FIRSTCHILD,CMA_ITEMORDER)); 350 404 while(pci && (INT)pci != -1) { 351 352 353 354 405 DosSleep(0L); 406 PrintToFile(hwndCnr,indent + 1,pci,fp); 407 pci = (PCNRITEM)WinSendMsg(hwndCnr,CM_QUERYRECORD,MPFROMP(pci), 408 MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER)); 355 409 } 356 410 } … … 359 413 360 414 361 static VOID FillCnr s(VOID *args)415 static VOID FillCnrThread (VOID *args) 362 416 { 363 417 HAB hab; 364 418 HMQ hmq; 365 DIRSIZE *dirsize = (DIRSIZE *)args;419 DIRSIZE *dirsize = (DIRSIZE *)args; 366 420 HWND hwndCnr; 367 ULONG totalbytes;421 ULONG ulTotal; 368 422 369 423 if(!dirsize) … … 378 432 hmq = WinCreateMsgQueue(hab,0); 379 433 if(hmq) { 434 BOOL fIsKB; 380 435 WinCancelShutdown(hmq,TRUE); 381 totalbytes = ProcessDir(hwndCnr,dirsize->filename,382 (PCNRITEM)NULL,dirsize->stopflag,TRUE);436 ulTotal = ProcessDir(hwndCnr,dirsize->pszFileName, 437 (PCNRITEM)NULL,dirsize->pchStopFlag,TRUE, &fIsKB); 383 438 DosPostEventSem(CompactSem); 384 439 WinEnableWindowUpdate(hwndCnr,FALSE); 385 FillInRecSizes(hwndCnr,NULL,totalbytes,dirsize->stopflag,TRUE); 440 if (!fIsKB) 441 ulTotal = (ulTotal >> 10) + (ulTotal & 0x3ff ? 1 : 0); 442 FillInRecSizes(hwndCnr,NULL,ulTotal,dirsize->pchStopFlag,TRUE); 386 443 WinEnableWindowUpdate(hwndCnr,TRUE); 387 444 WinSendMsg(hwndCnr,CM_INVALIDATERECORD,MPVOID, 388 445 MPFROM2SHORT(0,CMA_ERASE | CMA_TEXTCHANGED)); 389 446 WinDestroyMsgQueue(hmq); 390 447 } … … 392 449 } 393 450 PostMsg(WinQueryWindow(hwndCnr,QW_PARENT), 394 395 451 UM_CONTAINER_FILLED, 452 MPVOID,MPVOID); 396 453 free(dirsize); 397 454 } … … 400 457 MRESULT EXPENTRY DirSizeProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 401 458 { 402 TEMP * data;459 TEMP *pTemp; 403 460 404 461 switch(msg) { 405 462 case WM_INITDLG: 406 463 if(!mp2) { 407 408 409 } 410 data= malloc(sizeof(TEMP));411 if(! data) {412 413 414 } 415 memset( data,0,sizeof(TEMP));416 strcpy( data->dirname,(CHAR *)mp2);417 WinSetWindowPtr(hwnd,0,(PVOID) data);418 data->hptr = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,DIRSIZE_ICON);419 WinDefDlgProc(hwnd,WM_SETICON,MPFROMLONG( data->hptr),MPVOID);464 WinDismissDlg(hwnd,0); 465 break; 466 } 467 pTemp = malloc(sizeof(TEMP)); 468 if(!pTemp) { 469 WinDismissDlg(hwnd,0); 470 break; 471 } 472 memset(pTemp,0,sizeof(TEMP)); 473 strcpy(pTemp->dirname,(CHAR *)mp2); 474 WinSetWindowPtr(hwnd,0,(PVOID)pTemp); 475 pTemp->hptr = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,DIRSIZE_ICON); 476 WinDefDlgProc(hwnd,WM_SETICON,MPFROMLONG(pTemp->hptr),MPVOID); 420 477 { 421 422 423 424 425 data->dirname);426 478 CHAR s[CCHMAXPATH + 81]; 479 480 sprintf(s, 481 GetPString(IDS_DIRSIZETITLETEXT), 482 pTemp->dirname); 483 WinSetWindowText(hwnd,s); 427 484 } 428 485 { 429 430 431 432 433 434 435 436 dirsize->stopflag = (CHAR *)&data->stopflag;437 dirsize->filename = data->dirname;438 439 if(_beginthread(FillCnrs,NULL,122880L * 5L,(PVOID)dirsize) == -1) {440 441 442 443 444 data->working = TRUE;486 DIRSIZE *dirsize; 487 488 dirsize = malloc(sizeof(DIRSIZE)); 489 if(!dirsize) { 490 WinDismissDlg(hwnd,0); 491 break; 492 } 493 dirsize->pchStopFlag = (CHAR *)&pTemp->pchStopFlag; 494 dirsize->pszFileName = pTemp->dirname; 495 dirsize->hwndCnr = WinWindowFromID(hwnd,DSZ_CNR); 496 if(_beginthread(FillCnrThread,NULL,122880L * 5L,(PVOID)dirsize) == -1) { 497 free(dirsize); 498 WinDismissDlg(hwnd,0); 499 break; 500 } 501 pTemp->working = TRUE; 445 502 } 446 503 PostMsg(hwnd,UM_SETUP,MPVOID,MPVOID); … … 449 506 case UM_SETUP: 450 507 { 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 data= INSTDATA(hwnd);466 if(data && isalpha(*data->dirname)) {467 468 rc = DosQueryFSInfo(toupper(*data->dirname) - '@',FSIL_ALLOC,&fsa,469 470 471 472 473 474 475 508 CNRINFO cnri; 509 FSALLOCATE fsa; 510 APIRET rc; 511 512 memset(&cnri,0,sizeof(CNRINFO)); 513 cnri.cb = sizeof(CNRINFO); 514 WinSendDlgItemMsg(hwnd,DSZ_CNR,CM_QUERYCNRINFO, 515 MPFROMP(&cnri),MPFROMLONG(sizeof(CNRINFO))); 516 cnri.cyLineSpacing = 0; 517 cnri.cxTreeIndent = 12L; 518 cnri.flWindowAttr = CV_TREE | CV_FLOW | CA_TREELINE | CA_OWNERDRAW; 519 WinSendDlgItemMsg(hwnd,DSZ_CNR,CM_SETCNRINFO,MPFROMP(&cnri), 520 MPFROMLONG(CMA_FLWINDOWATTR | CMA_TREEICON | 521 CMA_LINESPACING | CMA_CXTREEINDENT)); 522 pTemp = INSTDATA(hwnd); 523 if(pTemp && isalpha(*pTemp->dirname)) { 524 memset(&fsa,0,sizeof(fsa)); 525 rc = DosQueryFSInfo(toupper(*pTemp->dirname) - '@',FSIL_ALLOC,&fsa, 526 sizeof(FSALLOCATE)); 527 if(!rc) { 528 529 CHAR s[132],tf[80],tb[80],tu[80]; 530 531 commafmt(tf,sizeof(tf), 532 (ULONG)(((float)fsa.cUnitAvail * 476 533 (fsa.cSectorUnit * fsa.cbSector)) / 1024L)); 477 478 534 commafmt(tb,sizeof(tb), 535 (ULONG)(((float)fsa.cUnit * 479 536 (fsa.cSectorUnit * fsa.cbSector)) / 1024L)); 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 537 commafmt(tu,sizeof(tu), 538 (ULONG)(((float)(fsa.cUnit - fsa.cUnitAvail) * 539 (fsa.cSectorUnit * fsa.cbSector)) / 1024L)); 540 sprintf(s, 541 GetPString(IDS_FREESPACETEXT), 542 tf, 543 tb, 544 tu); 545 WinSetDlgItemText(hwnd, 546 DSZ_FREESPACE, 547 s); 548 } 549 else 550 WinSetDlgItemText(hwnd, 551 DSZ_FREESPACE, 552 GetPString(IDS_FREESPACEUTEXT)); 553 } 497 554 } 498 555 return 0; 499 556 500 557 case UM_CONTAINER_FILLED: 501 data = INSTDATA(hwnd); 502 if(!data || data->dying) { 503 data->working = FALSE; 504 WinDismissDlg(hwnd,0); 505 return 0; 506 } 507 data->working = FALSE; 558 pTemp = INSTDATA(hwnd); 559 if(!pTemp || pTemp->dying) { 560 if (pTemp) 561 pTemp->working = FALSE; 562 WinDismissDlg(hwnd,0); 563 return 0; 564 } 565 pTemp->working = FALSE; 508 566 { 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 567 CHAR tb[44],s[66]; 568 PCNRITEM pci; 569 570 pci = WinSendDlgItemMsg(hwnd,DSZ_CNR,CM_QUERYRECORD,MPVOID, 571 MPFROM2SHORT(CMA_FIRST,CMA_ITEMORDER)); 572 if(pci && (INT)pci != -1) 573 WinSendDlgItemMsg(hwnd,DSZ_CNR,CM_EXPANDTREE,MPFROMP(pci),MPVOID); 574 *s = 0; 575 pci = WinSendDlgItemMsg(hwnd,DSZ_CNR,CM_QUERYRECORDEMPHASIS, 576 MPFROMLONG(CMA_FIRST), 577 MPFROMSHORT(CRA_CURSORED)); 578 if(pci && (INT)pci != -1) { 579 commafmt(tb,sizeof(tb),pci->attrFile); 580 sprintf(s, 581 "%s %s%s", 582 tb, 583 GetPString(IDS_FILETEXT), 584 &"s"[pci->attrFile == 1]); 585 } 586 WinSetDlgItemText(hwnd,DSZ_NUMFILES,s); 529 587 } 530 588 WinSendDlgItemMsg(hwnd,DSZ_CNR,CM_SORTRECORD,MPFROMP(SortSizeCnr), 531 589 MPVOID); 532 590 DosBeep(500,25); 533 591 return 0; … … 539 597 case UM_STRETCH: 540 598 { 541 542 543 544 545 546 547 548 549 550 551 552 553 599 SWP swpC,swp; 600 601 WinQueryWindowPos(hwnd,&swp); 602 if(!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) { 603 WinQueryWindowPos(WinWindowFromID(hwnd,DSZ_CNR),&swpC); 604 WinSetWindowPos(WinWindowFromID(hwnd,DSZ_CNR),HWND_TOP, 605 SysVal(SV_CXSIZEBORDER), 606 swpC.y, 607 swp.cx - (SysVal(SV_CXSIZEBORDER) * 2), 608 (swp.cy - swpC.y) - (SysVal(SV_CYTITLEBAR) + 609 SysVal(SV_CYSIZEBORDER)), 610 SWP_MOVE | SWP_SIZE); 611 } 554 612 } 555 613 return 0; … … 558 616 if(mp2) { 559 617 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 /* fill box with graph bar*/648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 618 OWNERITEM *oi = mp2; 619 CNRDRAWITEMINFO *cnd; 620 PCNRITEM pci; 621 622 if(oi->idItem == CMA_TEXT) { 623 cnd = (CNRDRAWITEMINFO *)oi->hItem; 624 if(cnd) { 625 pci = (PCNRITEM)cnd->pRecord; 626 if(pci) { 627 628 POINTL aptl[TXTBOX_COUNT],ptl; 629 CHAR *p; 630 LONG clr,x; 631 632 p = strchr(pci->szFileName,'\r'); 633 if(p) { 634 /* draw text */ 635 if(!pci->cbFile) /* no size */ 636 GpiSetColor(oi->hps,CLR_DARKGRAY); 637 else if(!pci->easize) /* no size below */ 638 GpiSetColor(oi->hps,CLR_DARKBLUE); 639 else 640 GpiSetColor(oi->hps,CLR_BLACK); 641 GpiSetBackMix(oi->hps,BM_LEAVEALONE); 642 GpiSetMix(oi->hps,FM_OVERPAINT); 643 *p = 0; 644 GpiQueryTextBox(oi->hps,strlen(pci->szFileName), 645 pci->szFileName,TXTBOX_COUNT,aptl); 646 ptl.x = oi->rclItem.xLeft; 647 ptl.y = (oi->rclItem.yTop - aptl[TXTBOX_TOPRIGHT].y); 648 GpiMove(oi->hps,&ptl); 649 GpiCharString(oi->hps,strlen(pci->szFileName), 650 pci->szFileName); 651 *p = '\r'; 652 653 /* draw the graph box */ 654 GpiQueryTextBox(oi->hps,1,"#",TXTBOX_COUNT,aptl); 655 /* draw black outline */ 656 GpiSetColor(oi->hps,CLR_BLACK); 657 ptl.x = oi->rclItem.xLeft; 658 ptl.y = oi->rclItem.yBottom + 2; 659 GpiMove(oi->hps,&ptl); 660 ptl.x = oi->rclItem.xLeft + 101; 661 ptl.y = (oi->rclItem.yBottom + aptl[TXTBOX_TOPRIGHT].y); 662 GpiBox(oi->hps,DRO_OUTLINE,&ptl,0,0); 663 /* fill with gray */ 664 GpiSetColor(oi->hps,CLR_PALEGRAY); 665 ptl.x = oi->rclItem.xLeft + 1; 666 ptl.y = oi->rclItem.yBottom + 3; 667 GpiMove(oi->hps,&ptl); 668 ptl.x = oi->rclItem.xLeft + 100; 669 ptl.y = (oi->rclItem.yBottom + aptl[TXTBOX_TOPRIGHT].y) - 1; 670 GpiBox(oi->hps,DRO_OUTLINEFILL,&ptl,0,0); 671 672 /* draw shadow at bottom & right sides */ 673 GpiSetColor(oi->hps,CLR_DARKGRAY); 674 ptl.x = oi->rclItem.xLeft + 1; 675 ptl.y = oi->rclItem.yBottom + 3; 676 GpiMove(oi->hps,&ptl); 677 ptl.x = oi->rclItem.xLeft + 100; 678 GpiLine(oi->hps,&ptl); 679 ptl.y = (oi->rclItem.yBottom + aptl[TXTBOX_TOPRIGHT].y) - 1; 680 GpiLine(oi->hps,&ptl); 681 682 /* draw highlight at top and left sides */ 683 GpiSetColor(oi->hps,CLR_WHITE); 684 ptl.x = oi->rclItem.xLeft + 1; 685 GpiLine(oi->hps,&ptl); 686 ptl.y = oi->rclItem.yBottom + 3; 687 GpiLine(oi->hps,&ptl); 688 689 /* draw shadow of box */ 690 GpiSetColor(oi->hps,CLR_DARKGRAY); 691 ptl.x = oi->rclItem.xLeft + 2; 692 ptl.y = oi->rclItem.yBottom; 693 GpiMove(oi->hps,&ptl); 694 ptl.x = oi->rclItem.xLeft + 103; 695 GpiLine(oi->hps,&ptl); 696 ptl.y = (oi->rclItem.yBottom + aptl[TXTBOX_TOPRIGHT].y) - 2; 697 GpiLine(oi->hps,&ptl); 698 ptl.x--; 699 GpiMove(oi->hps,&ptl); 700 ptl.y = oi->rclItem.yBottom + 1; 701 GpiLine(oi->hps,&ptl); 702 ptl.x = oi->rclItem.xLeft + 2; 703 GpiLine(oi->hps,&ptl); 704 705 /* fill box with graph bar, flags is integer % */ 706 if(pci->flags) { 707 if(pci->Longname[1] == 1) /* is root record */ 708 GpiSetColor(oi->hps,CLR_DARKGREEN); 709 else 710 GpiSetColor(oi->hps,CLR_RED); 711 ptl.x = oi->rclItem.xLeft + 1; 712 ptl.y = oi->rclItem.yBottom + 3; 713 GpiMove(oi->hps,&ptl); 714 ptl.x = oi->rclItem.xLeft + pci->flags; 715 ptl.y = (oi->rclItem.yBottom + aptl[TXTBOX_TOPRIGHT].y) - 1; 716 GpiBox(oi->hps,DRO_OUTLINEFILL,&ptl,0,0); 717 718 /* draw highlights and shadows on graph */ 719 if(pci->Longname[1] == 1) 720 GpiSetColor(oi->hps,CLR_GREEN); 721 else 722 GpiSetColor(oi->hps,CLR_PALEGRAY); 723 if(pci->flags > 5) { 724 ptl.x = oi->rclItem.xLeft + 1; 725 ptl.y = oi->rclItem.yBottom + 3; 726 GpiMove(oi->hps,&ptl); 727 ptl.y = (oi->rclItem.yBottom + aptl[TXTBOX_TOPRIGHT].y) - 1; 728 GpiLine(oi->hps,&ptl); 729 } 730 else { 731 ptl.y = (oi->rclItem.yBottom + aptl[TXTBOX_TOPRIGHT].y) - 1; 732 GpiMove(oi->hps,&ptl); 733 } 734 ptl.x = oi->rclItem.xLeft + pci->flags; 735 GpiLine(oi->hps,&ptl); 736 if(pci->Longname[1] != 1) { 737 GpiSetColor(oi->hps,CLR_DARKRED); 738 ptl.x = oi->rclItem.xLeft + 2; 739 ptl.y = oi->rclItem.yBottom + 3; 740 GpiMove(oi->hps,&ptl); 741 ptl.x = oi->rclItem.xLeft + pci->flags; 742 GpiLine(oi->hps,&ptl); 743 } 744 } 745 746 /* draw hash marks in box */ 747 GpiSetColor(oi->hps,CLR_WHITE); 748 clr = CLR_WHITE; 749 for(x = 1;x < 10;x++) { 750 if(clr == CLR_WHITE && x * 10 > pci->flags) { 751 clr = CLR_BLACK; 752 GpiSetColor(oi->hps,CLR_BLACK); 753 } 754 ptl.x = (oi->rclItem.xLeft + 1) + (x * 10); 755 ptl.y = oi->rclItem.yBottom + aptl[TXTBOX_TOPRIGHT].y - 1; 756 GpiMove(oi->hps,&ptl); 757 switch(x) { 758 case 1: 759 case 3: 760 case 7: 761 case 9: 762 ptl.y -= 1; 763 break; 764 case 5: 765 ptl.y -= 4; 766 break; 767 case 2: 768 case 4: 769 case 6: 770 case 8: 771 ptl.y -= 2; 772 break; 773 } 774 GpiLine(oi->hps,&ptl); 775 } 776 return MRFROMLONG(TRUE); 777 } 778 } 779 } 780 } 723 781 } 724 782 return FALSE; … … 726 784 case WM_CONTROL: 727 785 switch(SHORT2FROMMP(mp1)) { 728 729 730 731 732 CHAR filename[CCHMAXPATH],temp[CCHMAXPATH];733 734 735 *filename = 0;736 737 memset(temp,0,sizeof(temp));738 strncpy(temp,pci->szFileName,739 740 strrev(temp);741 if(*filename && *temp != '\\')742 strcat(filename,"\\");743 strcat(filename,temp);744 745 746 747 748 749 strrev(filename);750 751 752 753 754 755 filename);756 757 758 759 760 761 762 763 764 765 if(IsRoot(filename))766 767 768 769 770 OpenObject(filename,s,hwnd);771 772 773 774 775 776 data= INSTDATA(hwnd);777 if(data && !data->working && mp2) {778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 786 case CN_ENTER: 787 if(mp2) { 788 789 PCNRITEM pci = (PCNRITEM)((PNOTIFYRECORDENTER)mp2)->pRecord; 790 CHAR pszFileName[CCHMAXPATH],szTemp[CCHMAXPATH]; 791 792 if(pci) { 793 *pszFileName = 0; 794 while(pci && (INT)pci != -1) { 795 memset(szTemp,0,sizeof(szTemp)); 796 strncpy(szTemp,pci->szFileName, 797 pci->pszFileName - pci->szFileName); 798 strrev(szTemp); 799 if(*pszFileName && *szTemp != '\\') 800 strcat(pszFileName,"\\"); 801 strcat(pszFileName,szTemp); 802 pci = WinSendDlgItemMsg(hwnd,DSZ_CNR,CM_QUERYRECORD, 803 MPFROMP(pci), 804 MPFROM2SHORT(CMA_PARENT, 805 CMA_ITEMORDER)); 806 } 807 strrev(pszFileName); 808 if(!fVTreeOpensWPS) 809 OpenDirCnr((HWND)0, 810 (hwndMain) ? hwndMain : HWND_DESKTOP, 811 hwnd, 812 FALSE, 813 pszFileName); 814 else { 815 816 ULONG size = sizeof(ULONG),flWindowAttr = CV_ICON; 817 CHAR s[33]; 818 819 strcpy(s,"ICON"); 820 PrfQueryProfileData(fmprof,appname,"DirflWindowAttr", 821 (PVOID)&flWindowAttr,&size); 822 if(flWindowAttr & CV_DETAIL) { 823 if(IsRoot(pszFileName)) 824 strcpy(s,"TREE"); 825 else 826 strcpy(s,"DETAILS"); 827 } 828 OpenObject(pszFileName,s,hwnd); 829 } 830 } 831 } 832 break; 833 case CN_EMPHASIS: 834 pTemp = INSTDATA(hwnd); 835 if(pTemp && !pTemp->working && mp2) { 836 837 PNOTIFYRECORDEMPHASIS pre = mp2; 838 PCNRITEM pci; 839 CHAR tb[44],s[66]; 840 841 pci = (PCNRITEM)((pre) ? pre->pRecord : NULL); 842 if(pci && (pre->fEmphasisMask & CRA_SELECTED) && 843 (pci->rc.flRecordAttr & CRA_SELECTED)) { 844 commafmt(tb,sizeof(tb),pci->attrFile); 845 sprintf(s, 846 "%s %s%s", 847 tb, 848 GetPString(IDS_FILETEXT), 849 &"s"[pci->attrFile == 1]); 850 WinSetDlgItemText(hwnd, 851 DSZ_NUMFILES, 852 s); 853 } 854 } 855 break; 798 856 } 799 857 return 0; … … 801 859 case WM_COMMAND: 802 860 switch(SHORT1FROMMP(mp1)) { 803 804 805 806 807 808 809 810 811 data= INSTDATA(hwnd);812 if(data && !data->working) {813 814 CHAR filename[CCHMAXPATH];815 816 817 save_dir2(filename);818 sprintf(&filename[strlen(filename)],"\\%csizes.Rpt",819 (data) ? toupper(*data->dirname) : '+');820 if(export_filename(hwnd,filename,FALSE) && *filename) {821 if(stricmp(filename,"PRN") &&822 strnicmp(filename,"\\DEV\\LPT",8) &&823 !strchr(filename,'.'))824 strcat(filename,".RPT");825 fp = fopen(filename,"a+");826 827 828 829 830 831 832 833 834 835 836 837 filename);838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 data= INSTDATA(hwnd);862 if(data) {863 if(data->working) {864 data->dying = TRUE;865 data->stopflag = 0xff;866 867 868 869 870 871 861 case IDM_HELP: 862 if(hwndHelp) 863 WinSendMsg(hwndHelp,HM_DISPLAY_HELP, 864 MPFROM2SHORT(HELP_DIRSIZE,0), 865 MPFROMSHORT(HM_RESOURCEID)); 866 break; 867 868 case DSZ_PRINT: 869 pTemp = INSTDATA(hwnd); 870 if(pTemp && !pTemp->working) { 871 872 CHAR pszFileName[CCHMAXPATH]; 873 FILE *fp; 874 875 save_dir2(pszFileName); 876 sprintf(&pszFileName[strlen(pszFileName)],"\\%csizes.Rpt", 877 (pTemp) ? toupper(*pTemp->dirname) : '+'); 878 if(export_filename(hwnd,pszFileName,FALSE) && *pszFileName) { 879 if(stricmp(pszFileName,"PRN") && 880 strnicmp(pszFileName,"\\DEV\\LPT",8) && 881 !strchr(pszFileName,'.')) 882 strcat(pszFileName,".RPT"); 883 fp = fopen(pszFileName,"a+"); 884 if(fp) { 885 WinSetPointer(HWND_DESKTOP,hptrBusy); 886 PrintToFile(WinWindowFromID(hwnd,DSZ_CNR),0,NULL,fp); 887 fclose(fp); 888 WinSetPointer(HWND_DESKTOP,hptrArrow); 889 } 890 else 891 saymsg(MB_CANCEL, 892 hwnd, 893 GetPString(IDS_ERRORTEXT), 894 GetPString(IDS_COMPCANTOPENTEXT), 895 pszFileName); 896 } 897 } 898 else 899 DosBeep(50,100); 900 break; 901 902 case DSZ_EXPAND: 903 case DSZ_COLLAPSE: 904 { 905 PCNRITEM pci; 906 907 pci = (PCNRITEM)WinSendDlgItemMsg(hwnd,DSZ_CNR, 908 CM_QUERYRECORDEMPHASIS, 909 MPFROMLONG(CMA_FIRST), 910 MPFROMSHORT(CRA_CURSORED)); 911 if(pci) 912 ExpandAll(WinWindowFromID(hwnd,DSZ_CNR), 913 (SHORT1FROMMP(mp1) == DSZ_EXPAND),pci); 914 } 915 break; 916 917 case DID_OK: 918 case DID_CANCEL: 919 pTemp = INSTDATA(hwnd); 920 if(pTemp) { 921 if(pTemp->working) { 922 pTemp->dying = TRUE; 923 pTemp->pchStopFlag = 0xff; 924 DosBeep(1000,100); 925 } 926 else 927 WinDismissDlg(hwnd,0); 928 } 929 break; 872 930 } 873 931 return 0; 874 932 875 933 case WM_CLOSE: 876 data= INSTDATA(hwnd);877 if( data)878 data->stopflag = 0xff;934 pTemp = INSTDATA(hwnd); 935 if(pTemp) 936 pTemp->pchStopFlag = 0xff; 879 937 DosSleep(1L); 880 938 break; 881 939 882 940 case WM_DESTROY: 883 data= INSTDATA(hwnd);884 if( data) {885 data->stopflag = 0xff;886 if(data->hptr)887 WinDestroyPointer(data->hptr);888 889 free(data);941 pTemp = INSTDATA(hwnd); 942 if(pTemp) { 943 pTemp->pchStopFlag = 0xff; 944 if(pTemp->hptr) 945 WinDestroyPointer(pTemp->hptr); 946 DosSleep(33L); 947 free(pTemp); 890 948 } 891 949 DosPostEventSem(CompactSem);
Note:
See TracChangeset
for help on using the changeset viewer.