Microsoft KB Archive/41146

= QB 4.5 SHELL Forces Linefeed if Cursor Is on Line 25 =

Article ID: 41146

Article Last Modified on 11/21/2006



This article was previously published under Q41146



SYMPTOMS
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.



WORKAROUND
The following program can be used as a workaround to prevent the linefeed caused by SHELL: CLS WIDTH 80, 25 LOCATE 1, 1 PRINT &quot;LINE 1 now stays on the screen without scrolling.&quot; LOCATE 2, 1 PRINT &quot;LINE 2 remains as the second line.&quot; LOCATE 25, 1 PRINT &quot;LINE 25 : DOING A SHELL AFTER CURSOR IS MOVED TO LINE 23&quot;; xpos% = POS(0)      ' Saves the cursor position, which is ypos% = CSRLIN       ' currently on line 25. LOCATE 23, 1 SHELL &quot;DIR c:\ > TEST.TXT&quot; LOCATE ypos%, xpos% 'returns cursor to line 25 in remembered column.



STATUS
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.



MORE INFORMATION
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 &quot;LINE 1. This scrolls off the screen after SHELL.&quot; LOCATE 2,1 PRINT &quot;LINE 2. This line scrolls up one line.&quot; LOCATE 25,1 PRINT &quot;LINE 25: NOW DOING A SHELL&quot;; SHELL &quot; DIR c:\ > TEST.TXT&quot;

Additional query words: QuickBas BasicCom 4.50 4.5 7.00 7.10 buglist4.50

Keywords: KB41146

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.