Microsoft KB Archive/41146
Article ID: 41146
Article Last Modified on 11/21/2006
This article was previously published under Q41146
The first program below demonstrates that a SHELL statement in QuickBasic version 4.5 or Basic PDS 7.0 or 7.1 programs causes the screen to scroll up (linefeed) one line if the cursor is LOCATEd on line 25. (The problem occurs in programs run in both the QB.EXE/QBX.EXE editor and .EXE programs.)
If the cursor is not LOCATEd on line 25 at the time SHELL executes, then SHELL does not cause a linefeed.
The following program can be used as a workaround to prevent the linefeed caused by SHELL:
CLS WIDTH 80, 25 LOCATE 1, 1 PRINT "LINE 1 now stays on the screen without scrolling." LOCATE 2, 1 PRINT "LINE 2 remains as the second line." LOCATE 25, 1 PRINT "LINE 25 : DOING A SHELL AFTER CURSOR IS MOVED TO LINE 23"; xpos% = POS(0) ' Saves the cursor position, which is ypos% = CSRLIN ' currently on line 25. LOCATE 23, 1 SHELL "DIR c:\ > TEST.TXT" LOCATE ypos%, xpos% 'returns cursor to line 25 in remembered column.
Microsoft has confirmed this to be a bug in Microsoft QuickBasic version 4.5 (buglist4.50) and in Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 (buglist7.00, buglist7.10). We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. This problem does not occur in earlier versions.
The following program redirects output of a directory to a file and scrolls the screen up one line after the SHELL statement:
CLS WIDTH 80,25 ' Must use WIDTH or VIEW PRINT 1 to 25 to use line 25. LOCATE 1,1 PRINT "LINE 1. This scrolls off the screen after SHELL." LOCATE 2,1 PRINT "LINE 2. This line scrolls up one line." LOCATE 25,1 PRINT "LINE 25: NOW DOING A SHELL"; SHELL " DIR c:\ > TEST.TXT"
Additional query words: QuickBas BasicCom 4.50 4.5 7.00 7.10 buglist4.50