//******************************************************************* // // program - Dinfo.c // purpose - a Windows program to display directory utilization of a drive. // //******************************************************************* #include #include #include #include #include #include #include "wdinfo.h" // Data that can be referenced throughout the // program but not passed to other instances HWND hwndMainDialog ; HWND hwndMainWin ; HWND hMain ; // main window handle HWND hWnd ; HMENU hMenu ; HWND hAbout ; HANDLE hdlgr ; // i think it is handle of dialog like hMain HANDLE hInst ; // hInstance of application HANDLE hAccel ; static HWND hList ; static HWND hDirs ; static WORD W_ItemCnt ; LOGFONT cursfont; // font structure HANDLE holdsfont; // handle of original font HANDLE hnewsfont; // handle of new fixed font FARPROC lpMainDlgProc ; char DriveId[30] ; char DriveSel ; int driveln ; int baselo, basehi ; int xChar, yChar, yCharnl; // character size int hMainWin, wMainWin ; // height and width of Main Win static int Num_Dir ; // function prototypes long FAR PASCAL MainWndProc(HWND hWnd, WORD message, WORD wParam, LONG lParam); BOOL FAR PASCAL MainDlgProc(HWND hDlg, WORD message, WORD wParam, LONG lParam); void DinfoMain (void) ; void MsgListAdd (void) ; int logic(char *) ; void CheckButton(char) ; //******************************************************************* // WinMain - Dinfo main // // paramaters: // hInstance - The instance of this instance of this // application. // hPrevInstance - The instance of the previous instance // of this application. This will be 0 // if this is the first instance. // lpszCmdLine - A long pointer to the command line that // started this application. // cmdShow - Indicates how the window is to be shown // initially. ie. SW_SHOWNORMAL, SW_HIDE, // SW_MIMIMIZE. // // returns: // wParam from last message. // //******************************************************************* int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdLine, int cmdShow) { MSG msg ; WNDCLASS wndclass ; HDC hdc ; int hght, width ; LONG baseunit ; typedef struct tagDLGTEMPLATE { long dtStyle ; BYTE dtItemCount ; int dtX ; int dtY ; int dtCX ; int dtCY ; char dtMenuName[] ; char dtClassName[] ; char dtCaptionText[] ; } DLGTEMPLATE; DLGTEMPLATE FAR *dltp; // Define the window class for this application. if (!hPrevInstance) { wndclass.lpszClassName = "Dinfo:Main" ; wndclass.hInstance = hInstance; wndclass.lpfnWndProc = MainWndProc; wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hIcon = LoadIcon(hInstance, "SNAPSHOT"); wndclass.lpszMenuName = "WD_Menu" ; // NULL ; wndclass.hbrBackground = GetStockObject(WHITE_BRUSH); wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; // Register the class RegisterClass(&wndclass); } hInst = hInstance; // save for use by window procs baseunit = GetDialogBaseUnits() ; baselo = LOWORD(baseunit) ; // get x value for width basehi = HIWORD(baseunit) ; // get y value for height width = ((262*baselo) / 4) ; hght = ((184*basehi) /8) ; // Create applications main window. hWnd = CreateWindow( "Dinfo:Main", // window class name "Directory Information", // window title WS_CAPTION | WS_SYSMENU | WS_VISIBLE | WS_MINIMIZEBOX, CW_USEDEFAULT, 0, width, // CW_USEDEFAULT, hght, // 0, NULL, // no parent for this window NULL, // use the class menu hInstance, // who created this window NULL // no parms to pass on ); hwndMainWin = hWnd ; hAccel = LoadAccelerators(hInst, "WD_ACC") ; ShowWindow(hWnd, cmdShow) ; UpdateWindow(hWnd) ; while(GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(hMain, hAccel, &msg)) { TranslateMessage(&msg) ; DispatchMessage(&msg) ; } } return 0 ; } //******************************************************************* //******************************************************************* // MainWndProc - handles messages for this application // // paramaters: // hWnd - The window handle for this message // message - The message number // wParam - The WORD parmater for this message // lParam - The LONG parmater for this message // // returns: // depends on message. // //******************************************************************* long FAR PASCAL MainWndProc(HWND hwnd, WORD wMsg, WORD wParam, LONG lParam) { HDC hdc ; HWND thWnd ; TEXTMETRIC tm ; char drvchk ; char drv[5] ; int i, Xorig, Yorig, hght, width ; static HANDLE lhInst ; HANDLE hCursor ; switch (wMsg) { case WM_CREATE: hMain = hwnd ; // Get the display context. hdc = GetDC(hwnd); // Build fixed screen font. Needed to display columinar report. cursfont.lfHeight = 0 ; cursfont.lfWidth = 0 ; cursfont.lfEscapement = 0 ; cursfont.lfOrientation = 0 ; cursfont.lfWeight = FW_NORMAL; cursfont.lfItalic = FALSE; cursfont.lfUnderline = FALSE; cursfont.lfStrikeOut = FALSE; cursfont.lfCharSet = OEM_CHARSET; cursfont.lfOutPrecision = OUT_DEFAULT_PRECIS; cursfont.lfClipPrecision = CLIP_DEFAULT_PRECIS; cursfont.lfQuality = DEFAULT_QUALITY; cursfont.lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE ; strcpy(cursfont.lfFaceName, "Terminal"); hnewsfont = CreateFontIndirect((LPLOGFONT) &cursfont); // Install the font in the current display context. holdsfont = SelectObject(hdc, hnewsfont); // get text metrics for paint GetTextMetrics(hdc, &tm); xChar = tm.tmAveCharWidth; yChar = tm.tmHeight + tm.tmExternalLeading; yCharnl = tm.tmHeight; // Release the display context. ReleaseDC(hwnd, hdc); lhInst = ((LPCREATESTRUCT) lParam) -> hInstance ; lpMainDlgProc = MakeProcInstance(MainDlgProc, lhInst); Xorig = ((66*baselo) / 4) ; Yorig = ((3*basehi) /8) ; width = ((40*baselo) / 4) ; hght = ((12*basehi) /8) ; // Create Accept Button thWnd = CreateWindow( "BUTTON", // window class name "&Accept", // window title WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_DEFPUSHBUTTON, Xorig, Yorig, width, hght, hwnd, // parent for this window 102, // id for this window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((111*baselo) / 4) ; Yorig = ((3*basehi) /8) ; width = ((40*baselo) / 4) ; hght = ((12*basehi) /8) ; // Create Clear Button thWnd = CreateWindow( "BUTTON", // window class name "&Clear", // window title WS_VISIBLE | WS_CHILD | WS_TABSTOP, Xorig, Yorig, width, hght, hwnd, // parent for this window 103, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((156*baselo) / 4) ; Yorig = ((3*basehi) /8) ; width = ((40*baselo) / 4) ; hght = ((12*basehi) /8) ; // Create Cancel Button thWnd = CreateWindow( "BUTTON", // window class name "E&Xit", // window title WS_VISIBLE | WS_CHILD | WS_TABSTOP, Xorig, Yorig, width, hght, hwnd, // parent for this window 104, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((1*baselo) / 4) ; Yorig = ((46*basehi) /8) ; width = ((256*baselo) / 4) ; hght = ((113*basehi) /8) ; // Create Cancel Button thWnd = CreateWindow( "LISTBOX", // window class name NULL, // window title WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_BORDER, Xorig, Yorig, width, hght, hwnd, // parent for this window 101, // id of window lhInst, // who created this window NULL // no parms to pass on ); hList = thWnd ; Xorig = ((4*baselo) / 4) ; Yorig = ((24*basehi) /8) ; width = ((33*baselo) / 4) ; hght = ((11*basehi) /8) ; // Create Drv Button thWnd = CreateWindow( "STATIC", // window class name "Drives:", // window title WS_VISIBLE | WS_CHILD, Xorig, Yorig, width, hght, hwnd, // parent for this window 105, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((32*baselo) / 4) ; Yorig = ((22*basehi) /8) ; width = ((18*baselo) / 4) ; hght = ((12*basehi) /8) ; // Create Drv Button thWnd = CreateWindow( "BUTTON", // window class name " ", // window title WS_CHILD | WS_TABSTOP | BS_AUTORADIOBUTTON, Xorig, Yorig, width, hght, hwnd, // parent for this window W_Drv1, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((56*baselo) / 4) ; Yorig = ((22*basehi) /8) ; width = ((18*baselo) / 4) ; hght = ((12*basehi) /8) ; // Create Button thWnd = CreateWindow( "BUTTON", // window class name " ", // window title WS_CHILD | WS_TABSTOP | BS_AUTORADIOBUTTON, Xorig, Yorig, width, hght, hwnd, // parent for this window 107, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((80*baselo) / 4) ; Yorig = ((22*basehi) /8) ; width = ((18*baselo) / 4) ; hght = ((12*basehi) /8) ; // Create Button thWnd = CreateWindow( "BUTTON", // window class name " ", // window title WS_CHILD | WS_TABSTOP | BS_AUTORADIOBUTTON, Xorig, Yorig, width, hght, hwnd, // parent for this window 108, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((104*baselo) / 4) ; Yorig = ((22*basehi) /8) ; width = ((18*baselo) / 4) ; hght = ((12*basehi) /8) ; // Create Button thWnd = CreateWindow( "BUTTON", // window class name " ", // window title WS_CHILD | WS_TABSTOP | BS_AUTORADIOBUTTON, Xorig, Yorig, width, hght, hwnd, // parent for this window 109, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((128*baselo) / 4) ; Yorig = ((22*basehi) /8) ; width = ((18*baselo) / 4) ; hght = ((12*basehi) /8) ; // Create Button thWnd = CreateWindow( "BUTTON", // window class name " ", // window title WS_CHILD | WS_TABSTOP | BS_AUTORADIOBUTTON, Xorig, Yorig, width, hght, hwnd, // parent for this window 110, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((152*baselo) / 4) ; Yorig = ((22*basehi) /8) ; width = ((18*baselo) / 4) ; hght = ((12*basehi) /8) ; // Create Button thWnd = CreateWindow( "BUTTON", // window class name " ", // window title WS_CHILD | WS_TABSTOP | BS_AUTORADIOBUTTON, Xorig, Yorig, width, hght, hwnd, // parent for this window 111, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((176*baselo) / 4) ; Yorig = ((22*basehi) /8) ; width = ((18*baselo) / 4) ; hght = ((12*basehi) /8) ; // Create Button thWnd = CreateWindow( "BUTTON", // window class name " ", // window title WS_CHILD | WS_TABSTOP | BS_AUTORADIOBUTTON, Xorig, Yorig, width, hght, hwnd, // parent for this window 112, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((200*baselo) / 4) ; Yorig = ((22*basehi) /8) ; width = ((18*baselo) / 4) ; hght = ((12*basehi) /8) ; // Create Button thWnd = CreateWindow( "BUTTON", // window class name " ", // window title WS_CHILD | WS_TABSTOP | BS_AUTORADIOBUTTON, Xorig, Yorig, width, hght, hwnd, // parent for this window 113, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((224*baselo) / 4) ; Yorig = ((22*basehi) /8) ; width = ((18*baselo) / 4) ; hght = ((12*basehi) /8) ; // Create Button thWnd = CreateWindow( "BUTTON", // window class name " ", // window title WS_CHILD | WS_TABSTOP | BS_AUTORADIOBUTTON, Xorig, Yorig, width, hght, hwnd, // parent for this window 114, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((63*baselo) / 4) ; Yorig = ((34*basehi) /8) ; width = ((104*baselo) / 4) ; hght = ((9*basehi) /8) ; // Create Cancel Button thWnd = CreateWindow( "STATIC", // window class name "Directories Processed:", // window title WS_VISIBLE | WS_CHILD, Xorig, Yorig, width, hght, hwnd, // parent for this window 115, // id of window lhInst, // who created this window NULL // no parms to pass on ); Xorig = ((148*baselo) / 4) ; Yorig = ((34*basehi) /8) ; width = ((27*baselo) / 4) ; hght = ((9*basehi) /8) ; // Create Button thWnd = CreateWindow( "STATIC", // window class name "", // window title WS_VISIBLE | WS_CHILD, Xorig, Yorig, width, hght, hwnd, // parent for this window 116, // id of window lhInst, // who created this window NULL // no parms to pass on ); // hList = GetDlgItem(hwnd, W_List) ; // get handle of list window SendMessage(hList, WM_SETFONT, hnewsfont, FALSE); driveln = logic(DriveId) ; if (DriveId[0] != 0x00) { drv[2] = 0x00 ; if (driveln > 9) { driveln = 9 ; DriveId[9] = 0x00 ; } DriveSel = DriveId[0] ; // set default drive id to first for (i=0; iname[0] = 0x00 ; rootptr->size = 0 ; rootptr->subsize = 0 ; rootptr->nest = 0 ; rootptr->subdir = NULL ; rootptr->subdirh = NULL ; rootptr->parent = NULL ; rootptr->parenth = NULL ; tot = 0 ; ParseSubs(rootptr,roothndl) ; /* start processing subdirs, including root*/ busychr = 9 ; PlaceStr(prtline,"Bytes used on disk: ",1) ; prtline[15] = DriveSel ; prtline[16] = ':' ; ltoa(tot,workprt,10) ; Nbrfmt(workprt) ; PlaceStr(prtline,workprt,24) ; t = time(NULL) ; strcpy(workprt,ctime(&t)) ; workprt[24] = 0x00 ; PlaceStr(prtline,workprt,40) ; // fprintf(fptr, "%s\n",prtline) ; MsgListAdd() ; MsgListAdd() ; getdfree((DriveSel-'A')+1, &free) ; if (free.df_sclus != 0xFFFF) { PlaceStr(prtline,"Bytes free on disk: ",1) ; d_avail = (long) free.df_avail * (long) free.df_bsec * (long) free.df_sclus ; ltoa(d_avail,workprt,10) ; Nbrfmt(workprt) ; PlaceStr(prtline,workprt,24) ; // fprintf(fptr, "%s\n",prtline) ; MsgListAdd() ; PlaceStr(prtline,"Disk capacity (bytes): ",1) ; d_cap = (long) free.df_total * (long) free.df_bsec * (long) free.df_sclus ; ltoa(d_cap,workprt,10) ; Nbrfmt(workprt) ; PlaceStr(prtline,workprt,24) ; // fprintf(fptr, "%s\n",prtline) ; MsgListAdd() ; } // fprintf(fptr, "%s\n",prtline) ; MsgListAdd() ; strcpy(rootptr->name, "(root)" ); size = rootptr->size ; pct = size / tot ; /* get sub-dirs percentage of total */ pct = pct* 100 ; /* make percentage real */ ltoa(rootptr->size,workprt,10) ; Nbrfmt(workprt) ; j = 2 ; PlaceStr(prtline,lucorn,j) ; PlaceStr(prtline,hbar,j+1) ; PlaceStr(prtline,rootptr->name,j+2) ; PlaceStr(prtline,workprt,j+12) ; sprintf(workprt,"%3.2f %%",pct) ; PlaceStr(prtline,workprt,j+29) ; // fprintf(fptr, "%s\n",prtline) ; MsgListAdd() ; ptrindx = 0 ; if (rootptr->subdir != NULL) { (DWORD FAR *)subdir = (DWORD FAR *) rootptr->subdir ; while (subdir->ptrent[ptrindx] != NULL) { (DWORD FAR *) parent = (DWORD FAR *) subdir->ptrent[ptrindx] ; parenth = subdir->ptrenth[ptrindx] ; if (subdir->ptrent[ptrindx+1] != NULL) { nestbar[0] = 1 ; DrawTree(parent,parenth,0) ; } else { nestbar[0] = 0 ; DrawTree(parent,parenth,1) ; } ptrindx = ptrindx + 1 ; } } // fprintf(fptr, "\n") ; // fprintf(fptr, " (C) Copyright George Hulse, 1991\n") ; // farfree(rootptr) ; GlobalUnlock(roothndl) ; GlobalFree(roothndl) ; memalc = memalc / 1024 ; // printf("\n") ; // printf("%5.2f k bytes used for directory tree",memalc) ; } /* end main code */ void ParseSubs(struct direntry FAR *parentd, GLOBALHANDLE parenth) { struct direntry FAR *dirptr ; struct ptrelist FAR *subdir ; struct direntry FAR *parent ; GLOBALHANDLE parenth2 ; GLOBALHANDLE dirptrh ; char dirname[100], dirhold[100] ; int done, attr, i, j, ptrindx, attr2 ; Dir_Proc() ; // if ( (parentd->subdir = farmalloc(sizeof(struct ptrelist)) ) == NULL ) hGlobalMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(struct ptrelist)) ; parentd->subdirh = hGlobalMem ; if (hGlobalMem == NULL) { MessageBox(NULL,"Insufficient memory available for processing", NULL,MB_OK) ; // exit(1) ; } (DWORD FAR *) parentd->subdir = (DWORD FAR *) GlobalLock(hGlobalMem) ; memalc = memalc + sizeof(struct ptrelist) ; dirname[0] = 0x00 ; dirhold[0] = 0x00 ; strcpy(dirname,parentd->name) ; (DWORD FAR *) parent = (DWORD FAR *) parentd->parent ; while (parent != NULL) { strcpy(dirhold,parent->name) ; if (parent->name[0] != 0x00) strcat(dirhold,"\\") ; strcat(dirhold,dirname) ; strcpy(dirname,dirhold) ; dirhold[0] = 0x00 ; (DWORD FAR *) dirptr = (DWORD FAR *) parent->parent ; parent = dirptr ; } strcpy(dirhold,Tree) ; strcat(dirhold,"\\") ; strcat(dirhold,dirname) ; if (strlen(dirhold) > 3) strcat(dirhold,"\\") ; strcat(dirhold,"*.*") ; strcpy(dirname,dirhold) ; ptrindx = 0 ; (DWORD FAR *) subdir = (DWORD FAR *) parentd->subdir ; subdir->ptrent[0] = NULL ; subdir->ptrenth[0] = NULL ; attr = dattr ; done = findfirst(dirname,&finfo,attr) ; while (!done) { if (finfo.ff_attrib == attr) { if (finfo.ff_name[0] != '.') { // if ( (dirptr = farmalloc(sizeof(struct direntry)) ) == NULL ) hGlobalMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(struct direntry)) ; dirptrh = hGlobalMem ; if (hGlobalMem == NULL) { MessageBox(NULL, "Insufficient memory available for processing", NULL,MB_OK) ; // exit(1) ; } else { (DWORD FAR *) dirptr = (DWORD FAR *) GlobalLock(hGlobalMem); memalc = memalc + sizeof(struct direntry) ; strcpy(dirptr->name,finfo.ff_name) ; dirptr->size = 0 ; dirptr->subsize = 0 ; dirptr->nest = parentd->nest + 1 ; (DWORD FAR *) dirptr->parent = (DWORD FAR *) parentd ; dirptr->parenth = parenth ; dirptr->subdir = NULL ; dirptr->subdirh = NULL ; subdir->ptrenth[ptrindx] = dirptrh ; (DWORD FAR *) subdir->ptrent[ptrindx] = (DWORD FAR *) dirptr ; ptrindx = ptrindx + 1 ; subdir->ptrent[ptrindx] = NULL ; subdir->ptrenth[ptrindx] = NULL ; } } } done = findnext(&finfo) ; } attr2 = fattr ; done = findfirst(dirname,&finfo,attr2) ; while (!done) { parentd->size = parentd->size + finfo.ff_fsize ; done = findnext(&finfo) ; } tot = tot + parentd->size ; ptrindx = 0 ; if (parentd->subdir != NULL) { (DWORD FAR *) subdir = (DWORD FAR *) parentd->subdir ; while (subdir->ptrent[ptrindx] != NULL) { (DWORD FAR *) parent = (DWORD FAR *) subdir->ptrent[ptrindx] ; parenth2 = subdir->ptrenth[ptrindx] ; ParseSubs(parent,parenth2) ; ptrindx = ptrindx + 1 ; } } (DWORD FAR *) parent = (DWORD FAR *) parentd->parent ; if (parent != NULL) parent->subsize = parent->subsize + parentd->size + parentd->subsize ; } void DrawTree(struct direntry FAR *parentd, GLOBALHANDLE parenth, int last) { int i, j, ptrindx ; struct direntry FAR *parent ; struct ptrelist FAR *subdir ; GLOBALHANDLE parenth2 ; GLOBALHANDLE subdirh2 ; subpct = 0 ; size = parentd->size ; pct = size / tot ; /* get sub-dirs percentage of total */ pct = pct* 100 ; /* make percentage real */ if (parentd->subsize > 0) { size = size + parentd->subsize ; subpct = size / tot ; /* get sub-sub-dirs percentage of total */ subpct = subpct* 100 ; /* make percentage real */ } ltoa(parentd->size,workprt,10) ; Nbrfmt(workprt) ; j = 2 ; // starting position of bars for (i=1; i < parentd->nest ; i++) { if (nestbar[i] == 1) PlaceStr(prtline,bar,j) ; j = j + 2 ; } if (last == 0) { nestbar[parentd->nest] = 1 ; PlaceStr(prtline,ltbar,j) ; } else { nestbar[parentd->nest] = 0 ; PlaceStr(prtline,lcorn,j) ; } PlaceStr(prtline,hbar,j+1) ; PlaceStr(prtline,parentd->name,j+2) ; PlaceStr(prtline,workprt,j+12) ; sprintf(workprt,"%3.2f %%",pct) ; PlaceStr(prtline,workprt,j+27) ; // was 29 if (subpct > 0) { sprintf(workprt,"(%3.2f %%)",subpct) ; PlaceStr(prtline,workprt,j+37) ; // was 39 } // fprintf(fptr, "%s\n",prtline) ; MsgListAdd() ; ptrindx = 0 ; if (parentd->subdir != NULL) { (DWORD FAR *)subdir = (DWORD FAR *) parentd->subdir ; while (subdir->ptrent[ptrindx] != NULL) { (DWORD FAR *) parent = (DWORD FAR *) subdir->ptrent[ptrindx] ; parenth2 = subdir->ptrenth[ptrindx] ; if (subdir->ptrent[ptrindx+1] != NULL) DrawTree(parent,parenth,0) ; else DrawTree(parent,parenth2,1) ; hGlobalMem = parent->subdirh ; GlobalUnlock(hGlobalMem) ; GlobalFree(hGlobalMem) ; hGlobalMem = parenth2 ; GlobalUnlock(hGlobalMem) ; GlobalFree(hGlobalMem) ; // farfree(parent->subdir) ; // farfree(parent) ; ptrindx = ptrindx + 1 ; } } } void PlaceStr(char *dest, char *src, int ptr) { int i, len ; i = 0 ; len = strlen(src) ; for (i = 0; i < len; i++) { dest[ptr] = src[i] ; ptr = ptr + 1 ; } } void Nbrfmt(char *src) { int i, j, k, len ; char fmt[14] ; j = 13 ; for (i = 0; i <14; i++) fmt[i] = ' ' ; fmt[14] = 0x00 ; k = 0 ; len = strlen(src) ; for (i = len-1; i > -1; i--) { if (k == 3) { fmt[j] = ',' ; j = j - 1 ; k = 0 ; } fmt[j] = src[i] ; j = j - 1 ; k = k + 1 ; } for (i=0; i<14; i++) src[i] = fmt[i] ; src[14] = 0x00 ; } void MsgListAdd() { int i ; long rc ; MSG msg ; for (i = 78; i > -1; i--) if (prtline[i] > ' ') { prtline[i+1] = 0x00 ; i = -1 ; } // rc = SendDlgItemMessage(hMain, W_List, LB_ADDSTRING, W_ItemCnt, // (LONG) ((LPSTR) prtline)) ; rc = SendMessage(hList, LB_ADDSTRING, W_ItemCnt, (LONG) ((LPSTR) prtline)) ; if (rc == LB_ERR || rc == LB_ERRSPACE) { MessageBox(NULL,"Insufficient memory available for processing", "* ERROR *",MB_ICONEXCLAMATION | MB_OK) ; } W_ItemCnt++ ; for (i = 0; i < 79; i++) prtline[i] = ' ' ; prtline[79] = 0x00 ; } void Dir_Proc() { Num_Dir++ ; SetDlgItemInt(hMain, W_Dirs, Num_Dir, FALSE) ; }