TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Joey Mukherjee
from: Bill Parker
date: 1995-02-07 09:30:30
subject: DosFindFirst

JM> DosFindFirst and KbdCharIn?  Is there an INF (or 
 JM> collection of source) somewhere that has examples of 
 JM> all the commands that are in PRCP?

Hmmm...I don't recognize the term 'PRCP' so perhaps you are using a
different compiler than I. Under the CSet toolkit this information is in my
TOOLKT20/BOOK directory and can be viewed by saying 'view progref20'. (I'm
probably a rev or two back, those 20's might be 21's or 30's now.)

 JM> Next, could someone post a short example of how to use 
 JM> DosFindFirst and KbdCharIn?

I needed to do DosFindFirst recently and didn't find the canned example to
be very useful, so here's a snippet of what I did...

#define     INCL_DOS
#define     INCL_ERRORS
#include    
#include    
#include    

/*
This routine returns a value between 0 and 99 which represents the
largest recording filename sequence number found on the current
directory. If no recording files are present then a 0 is returned.
*/

int  FindLargestRcdSequenceNumber(void)
{
    int           nResult    = 0;
    int           nVal;
    ULONG         rc;
    ULONG         Count  = 1;
    HDIR          Handle = 0x0001;
    FILEFINDBUF3  Find;

    rc = DosFindFirst("VXS??.RCD", &Handle, FILE_ARCHIVED,
           (PVOID)&Find, sizeof(Find), &Count, 1);

    while ((rc == 0) && (Count == 1))
    {
        if ((Find.achName[3] >= '0') && (Find.achName[3] <=
'9') &&
            (Find.achName[4] >= '0') && (Find.achName[4] <= '9'))
        {
            nVal = (Find.achName[3]-'0')*10 + (Find.achName[4]-'0');
            if (nVal > nResult)
                nResult = nVal;
        }
        rc = DosFindNext(Handle, (PVOID)&Find, sizeof(Find), &Count);
    }
    return nResult;
}

Bill

--- Maximus/2 2.01wb
* Origin: Blue Bird Of Prey * Vergennes, VT * (802) 877-6912 (1:325/207)
SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430
SEEN-BY: 711/807 808 809 934 942 949 955 712/515 713/888 800/1 7877/2809
@PATH: 325/207 118 320/209 142/1 3615/50 229/2 12/2442 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.