j'ai réçemment essayé de mettre au point un programme en Quick Basic pour afficher le contenu d'un dossier.
QB dispose déjà d'une fonction préintégré nommée files qui écrit sur l'écran le contenu du répertoire en cours.
Mais je recherche des sources qui s'utilisent à la maniére de FindFirstFile et de FindNextFile.
J'ai longtemp cherché à utiliser les fonction 4E et 4F de l'interruption 21h sans succés, pourtant je ne sais toujours pas ou était mon erreur.
Dans mon code je commençais par appeler la fonction 4E, puis obtenir l'adresse de la DTA, puis reguarder dans la DTA... sans rien y trouver

J'ai trouvé sur MSDN une source en Quick Basic 2. La voici :
Code: Select all DIM InArray%(9), OutArray%(9) AX% = 0: DX% = 3: DS% = 8: CX% = 2 ' -- Register locations DTA$ = SPACE$(43) ' -- DTA Buffer size Path$ = "*.*" + CHR$(0) ' -- Search path, plus null byte REM -- Find Segment and Offset for the DTA (Disk Transfer Area) CALL PTR86(Seg1%, Off1%, VARPTR(DTA$)) REM -- The real Offset for the string DTA$ is found by using the REM SADD function. Off1% = SADD(DTA$) REM -- Set the DTA with Interrupt Hex 21, and Function Hex 1A InArray%(AX%) = &H1A00 InArray%(DX%) = Off1% InArray%(DS%) = Seg1% CALL INT86(&H21, VARPTR(InArray%(0)), VARPTR(OutArray%(0))) REM -- Find the Segment and Offset for the Search Path CALL PTR86(Seg1%, Off1%, VARPTR(Path$)) REM -- Real Offset is found by using the SADD function Off1% = SADD(Path$) REM -- Find the first file with Interrupt Hex 21, Function Hex 4E InArray%(AX%) = &H4E00 InArray%(CX%) = 22 InArray%(DX%) = Off1% InArray%(DS%) = Seg1% CALL INT86(&H21, VARPTR(InArray%(0)), VARPTR(OutArray%(0))) REM -- Stay in while loop until REM 18 = No more files REM 3 = Invalid search path -OR- no files found WHILE (OutArray%(AX%) <> 18) AND (OutArray%(AX%) <> 3) a% = CVI(MID$(DTA$, 27, 2)) ' -- Low word of file size b% = CVI(MID$(DTA$, 29, 2)) ' -- High word of file size IF a% < 0 THEN ' -- Calculate size relative to d! = 65536 + a% ' Low word ELSE d! = a% END IF IF b% < 0 THEN ' -- Calculate size with High word d! = d! + (65536 * (65536 + b%)) ELSE d! = d! + (65536 * b%) END IF PRINT RIGHT$(DTA$, 13); ' -- Print file name PRINT " "; PRINT d! ' and file size MID$(DTA$, 31, 13) = SPACE$(13) ' -- Blank out current name InArray%(AX%) = &H4F00 ' Function Hex 4F - Find Next File CALL INT86(&H21, VARPTR(InArray%(0)), VARPTR(OutArray%(0))) WEND END |
Code: Select all TYPE RegTypex AX AS INTEGER BX AS INTEGER CX AS INTEGER DX AS INTEGER BP AS INTEGER SI AS INTEGER DI AS INTEGER DS AS INTEGER ES AS INTEGER Flags AS INTEGER END TYPE DIM DTA AS STRING DTA = SPACE$(43) DIM Path AS STRING Path = "*.*" + CHR$(0) DIM Segment AS INTEGER, Offset AS INTEGER Segment = VARSEG(DTA) Offset = SADD(DTA) DIM RegIn AS RegTypex, RegOut AS RegTypex RegIn.AX = &H1A00 RegIn.DX = Offset RegIn.DS = Segment CALL Interruptx(&H21, RegIn, RegOut) Segment = VARSEG(Path) Offset = SADD(Path) DIM RegIn2 AS RegTypex, RegOut2 AS RegTypex RegIn.AX = &H4E00 RegIn.CX = 23 RegIn.DX = Offset RegIn.DS = Segment CALL Interruptx(&H21, RegIn2, RegOut2) |
J'ai testé toute sorte de code différents sans réussir ce que je souhaite
