Announcement

Collapse
No announcement yet.

Here we go again, Error 496 : Destination file write error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Here we go again, Error 496 : Destination file write error

    This program will run fine and close ok as long as you end it with an Esc. It will not end properly if you try to end it with the 'X' in the upper right corner! (If you do click the 'X' the console has not ended (I guess) and you get the Error 496 : Destination file write error.

    [code]
    #COMPILE EXE 'Sudoku_Graphic.bas 10/11/2008
    #BREAK ON
    #DIM ALL
    #CONSOLE OFF

    GLOBAL hWin AS DWORD
    DECLARE SUB Make_Sudoku_Grid
    DECLARE SUB SoundBeepBeepBeep
    FUNCTION PBMAIN () AS LONG
    LOCAL i,Str_Number AS STRING
    LOCAL x,a,b,CLICK,Number AS LONG
    'GRAPHIC WINDOW Horiz_start , Vert_start, Width, Height
    GRAPHIC WINDOW "Sudoku_Graphic.exe ---- Hit Escape to Quit", 0 , 0, 1018, 725 TO hWin
    GRAPHIC ATTACH hWin,0
    Make_Sudoku_Grid
    MOUSE ON
    DO
    IF hWin = 0 THEN EXIT LOOP
    GRAPHIC SET POS(1,700) 'col,row
    GRAPHIC FONT "Times New Roman", 10, 1
    GRAPHIC WINDOW CLICK TO CLICK , a,b
    GRAPHIC PRINT a;",";b;" "
    GRAPHIC FONT "Times New Roman", 14, 1
    SLEEP 200
    GRAPHIC INKEY$ TO i
    IF a >= 85 AND a <= 130 AND b >= 60 AND b <= 100 THEN
    Number = 1
    GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
    END IF
    IF a >= 185 AND a <= 230 AND b >= 60 AND b <= 100 THEN
    Number = 2
    GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
    END IF
    IF a >= 285 AND a <= 330 AND b >= 60 AND b <= 100 THEN
    Number = 3
    GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
    END IF
    IF a >= 385 AND a <= 430 AND b >= 60 AND b <= 100 THEN
    Number = 4
    GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
    END IF
    IF a >= 485 AND a <= 530 AND b >= 60 AND b <= 100 THEN
    Number = 5
    GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
    END IF
    IF a >= 585 AND a <= 630 AND b >= 60 AND b <= 100 THEN
    Number = 6
    GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
    END IF
    IF a >= 685 AND a <= 730 AND b >= 60 AND b <= 100 THEN
    Number = 7
    GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
    END IF
    IF a >= 785 AND a <= 830 AND b >= 60 AND b <= 100 THEN
    Number = 8
    GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
    END IF
    IF a >= 885 AND a <= 930 AND b >= 60 AND b <= 100 THEN
    Number = 9
    GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
    END IF
    IF a >= 485 AND a <= 530 AND b >= 10 AND b <= 50 THEN
    Number = 10
    IF Number = 10 THEN Str_Number = "Erase"
    GRAPHIC SET POS(600,5) : GRAPHIC PRINT Str_Number
    END IF
    LOOP UNTIL i = $ESC
    GRAPHIC WINDOW END
    END FUNCTION
    SUB Make_Sudoku_Grid
    LOCAL x,y AS LONG
    GRAPHIC WIDTH 3
    'GRAPHIC BOX (Upper Left horiz corner, Upper Left vert corner)
    '(Lower Right horiz corner, Lower Right vert corner)
    GRAPHIC BOX (300, 150) - (723, 573)
    GRAPHIC LINE (441,573)-(441,150) 'Vert Line 3
    GRAPHIC LINE (582,573)-(582,150) 'Vert Line 6
    GRAPHIC LINE (300,291)-(723,291) 'Horiz line 3
    GRAPHIC LINE (300,432)-(723,432) 'Horiz line 6
    GRAPHIC WIDTH 1
    GRAPHIC LINE (347,573)-(347,150) 'Vert Line 1
    GRAPHIC LINE (394,573)-(394,150) 'Vert Line 2
    GRAPHIC LINE (488,573)-(488,150) 'Vert Line 4
    GRAPHIC LINE (535,573)-(535,150) 'Vert Line 5
    GRAPHIC LINE (629,573)-(629,150) 'Vert Line 7
    GRAPHIC LINE (676,573)-(676,150) 'Vert Line 8
    GRAPHIC LINE (300,197)-(723,197) 'Horiz line 1
    GRAPHIC LINE (300,244)-(723,244) 'Horiz line 2
    GRAPHIC LINE (300,338)-(723,338) 'Horiz line 4
    GRAPHIC LINE (300,385)-(723,385) 'Horiz line 5
    GRAPHIC LINE (300,479)-(723,479) 'Horiz line 7
    GRAPHIC LINE (300,526)-(723,526) 'Horiz line 8
    'Top boxes
    'GRAPHIC BOX (Upper Left horiz corner, Upper Left vert corner)
    '(Lower Right horiz corner, Lower Right vert corner)
    GRAPHIC BOX (81, 5) - (131, 50),20
    GRAPHIC BOX (181, 5) - (231, 50),20
    GRAPHIC BOX (481, 5) - (531, 50),20
    GRAPHIC BOX (881, 5) - (931, 50),20
    ' horiz,vert
    GRAPHIC SET POS (88,10) : GRAPHIC PRINT "Erase"
    GRAPHIC SET POS (190,10) : GRAPHIC PRINT "Load"
    GRAPHIC SET POS (488,10) : GRAPHIC PRINT "Erase"
    GRAPHIC SET POS (544,10) : GRAPHIC PRINT "Number ="
    GRAPHIC SET POS (885,10) : GRAPHIC PRINT " Save"
    GRAPHIC SET POS (88,30) : GRAPHIC PRINT " File"
    GRAPHIC SET POS (190,30) : GRAPHIC PRINT " File"
    GRAPHIC SET POS (488,30) : GRAPHIC PRINT " Num"
    GRAPHIC SET POS (885,30) : GRAPHIC PRINT " File"
    y = 131
    FOR x = 1 TO 9
    GRAPHIC BOX (y - 50, 55) - (y, 105),20
    y = y + 100
    NEXT x
    GRAPHIC SET POS (225,115)
    GRAPHIC FONT "Times New Roman", 12, 3 ' bold + Italic = (1+2)
    GRAPHIC PRINT "Click on a number then click";
    GRAPHIC PRINT " on the Sudoku grid to place that number"
    GRAPHIC FONT "Times New Roman", 18, 1 'points=18,1 = bold
    ' horiz,vert
    FOR x = 1 TO 9
    GRAPHIC SET POS (x * 100,63) : GRAPHIC PRINT TRIM$(STR$(x))
    NEXT x
    GRAPHIC REDRAW
    END SUB
    SUB SoundBeepBeepBeep '-------------------- Sound 3 Beeps
    SLEEP 200
    BEEP : SLEEP 150 : BEEP : SLEEP 150 : BEEP : SLEEP 150
    END SUB
    [\code]
    Last edited by Lynn Wakefield; 11 Oct 2008, 11:49 PM. Reason: Wrong code start/stop

  • #2
    I do not get this error, butt yu have an unterminating loop in PBMAIN
    Here's code posted using the # icon above. You do not need to use &quote; HTML tagging for quotes here either. Code checks for valid window handle at the top of the main DO LOOP now.
    Code:
    #COMPILE EXE 'Sudoku_Graphic.bas 10/11/2008
    #BREAK ON
    #DIM ALL
    #CONSOLE OFF
    
    GLOBAL hWin AS DWORD
    DECLARE SUB Make_Sudoku_Grid
    DECLARE SUB SoundBeepBeepBeep
    
    FUNCTION PBMAIN
        LOCAL i,Str_Number AS STRING
        LOCAL x,a,b,CLICK,Number AS LONG
        'GRAPHIC WINDOW Horiz_start , Vert_start, Width, Height
        GRAPHIC WINDOW "Sudoku_Graphic.exe ---- Hit Escape to Quit", 0 , 0, 1018, 725 TO hWin
        GRAPHIC ATTACH hWin,0
        Make_Sudoku_Grid
        MOUSE ON
        DO
            IF hWin = 0 THEN EXIT LOOP
            GRAPHIC SET POS(1,700) 'col,row
            GRAPHIC FONT "Times New Roman", 10, 1
            GRAPHIC WINDOW CLICK hWin TO CLICK , a,b
            GRAPHIC PRINT a;",";b;" "
            GRAPHIC FONT "Times New Roman", 14, 1
            SLEEP 200
            GRAPHIC INKEY$ TO i
            IF a >= 85 AND a <= 130 AND b >= 60 AND b <= 100 THEN
                Number = 1
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
            END IF
            IF a >= 185 AND a <= 230 AND b >= 60 AND b <= 100 THEN
                Number = 2
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
            END IF
            IF a >= 285 AND a <= 330 AND b >= 60 AND b <= 100 THEN
                Number = 3
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
            END IF
            IF a >= 385 AND a <= 430 AND b >= 60 AND b <= 100 THEN
                Number = 4
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
            END IF
            IF a >= 485 AND a <= 530 AND b >= 60 AND b <= 100 THEN
                Number = 5
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
            END IF
            IF a >= 585 AND a <= 630 AND b >= 60 AND b <= 100 THEN
                Number = 6
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
            END IF
            IF a >= 685 AND a <= 730 AND b >= 60 AND b <= 100 THEN
                Number = 7
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
            END IF
            IF a >= 785 AND a <= 830 AND b >= 60 AND b <= 100 THEN
                Number = 8
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
            END IF
            IF a >= 885 AND a <= 930 AND b >= 60 AND b <= 100 THEN
                Number = 9
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;" "
            END IF
            IF a >= 485 AND a <= 530 AND b >= 10 AND b <= 50 THEN
                Number = 10
                IF Number = 10 THEN Str_Number = "Erase"
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Str_Number
            END IF
        LOOP UNTIL i = $ESC
        SLEEP 500
        GRAPHIC WINDOW END
    END FUNCTION
    
    SUB Make_Sudoku_Grid
        LOCAL x,y AS LONG
        GRAPHIC WIDTH 3
        'GRAPHIC BOX (Upper Left horiz corner, Upper Left vert corner)
        '(Lower Right horiz corner, Lower Right vert corner)
        GRAPHIC BOX (300, 150) - (723, 573)
        GRAPHIC LINE (441,573)-(441,150) 'Vert Line 3
        GRAPHIC LINE (582,573)-(582,150) 'Vert Line 6
        GRAPHIC LINE (300,291)-(723,291) 'Horiz line 3
        GRAPHIC LINE (300,432)-(723,432) 'Horiz line 6
        GRAPHIC WIDTH 1
        GRAPHIC LINE (347,573)-(347,150) 'Vert Line 1
        GRAPHIC LINE (394,573)-(394,150) 'Vert Line 2
        GRAPHIC LINE (488,573)-(488,150) 'Vert Line 4
        GRAPHIC LINE (535,573)-(535,150) 'Vert Line 5
        GRAPHIC LINE (629,573)-(629,150) 'Vert Line 7
        GRAPHIC LINE (676,573)-(676,150) 'Vert Line 8
        GRAPHIC LINE (300,197)-(723,197) 'Horiz line 1
        GRAPHIC LINE (300,244)-(723,244) 'Horiz line 2
        GRAPHIC LINE (300,338)-(723,338) 'Horiz line 4
        GRAPHIC LINE (300,385)-(723,385) 'Horiz line 5
        GRAPHIC LINE (300,479)-(723,479) 'Horiz line 7
        GRAPHIC LINE (300,526)-(723,526) 'Horiz line 8
        'Top boxes
        'GRAPHIC BOX (Upper Left horiz corner, Upper Left vert corner)
        '(Lower Right horiz corner, Lower Right vert corner)
        GRAPHIC BOX (81, 5) - (131, 50),20
        GRAPHIC BOX (181, 5) - (231, 50),20
        GRAPHIC BOX (481, 5) - (531, 50),20
        GRAPHIC BOX (881, 5) - (931, 50),20
        ' horiz,vert
        GRAPHIC SET POS (88,10) : GRAPHIC PRINT "Erase"
        GRAPHIC SET POS (190,10) : GRAPHIC PRINT "Load"
        GRAPHIC SET POS (488,10) : GRAPHIC PRINT "Erase"
        GRAPHIC SET POS (544,10) : GRAPHIC PRINT "Number ="
        GRAPHIC SET POS (885,10) : GRAPHIC PRINT " Save"
        GRAPHIC SET POS (88,30) : GRAPHIC PRINT " File"
        GRAPHIC SET POS (190,30) : GRAPHIC PRINT " File"
        GRAPHIC SET POS (488,30) : GRAPHIC PRINT " Num"
        GRAPHIC SET POS (885,30) : GRAPHIC PRINT " File"
        y = 131
        FOR x = 1 TO 9
            GRAPHIC BOX (y - 50, 55) - (y, 105),20
            y = y + 100
        NEXT x
        GRAPHIC SET POS (225,115)
        GRAPHIC FONT "Times New Roman", 12, 3 ' bold + Italic = (1+2)
        GRAPHIC PRINT "Click on a number then click";
        GRAPHIC PRINT " on the Sudoku grid to place that number"
        GRAPHIC FONT "Times New Roman", 18, 1 'points=18,1 = bold
        ' horiz,vert
        FOR x = 1 TO 9
            GRAPHIC SET POS (x * 100,63) : GRAPHIC PRINT TRIM$(STR$(x))
            NEXT x
        GRAPHIC REDRAW
    END SUB
    
    SUB SoundBeepBeepBeep '-------------------- Sound 3 Beeps
        SLEEP 200
        BEEP : SLEEP 150 : BEEP : SLEEP 150 : BEEP : SLEEP 150
    END SUB
    Rick Angell

    Comment


    • #3
      Here we go again, Error 496 : Destination file write error

      Richard --- you are the man, you did it!!!!
      Thanks line: IF hWin = 0 THEN EXIT LOOP fixed it!
      Thank you so much, Lynn

      Comment


      • #4
        Here we go again, Error 496 : Destination file write error

        Thought I would try to get the code entered right.
        Code:
        #COMPILE EXE      'Sudoku_Graphic.bas       10/11/2008
        #BREAK ON
        #DIM ALL
        #CONSOLE OFF
         
        GLOBAL hWin AS DWORD
        DECLARE SUB Make_Sudoku_Grid
        DECLARE SUB SoundBeepBeepBeep
        FUNCTION PBMAIN () AS LONG
            LOCAL i,Str_Number AS STRING
            LOCAL x,a,b,CLICK,Number AS LONG
            'GRAPHIC WINDOW                                Horiz_start , Vert_start, Width, Height
            GRAPHIC WINDOW &quot;Sudoku_Graphic.exe ---- Hit Escape to Quit&quot;, 0 , 0, 1018, 725  TO hWin
            GRAPHIC ATTACH hWin,0
            Make_Sudoku_Grid
            MOUSE ON
            DO
                IF hWin = 0 THEN EXIT LOOP
                GRAPHIC SET POS(1,700)  'col,row
                GRAPHIC FONT &quot;Times New Roman&quot;, 10, 1
                GRAPHIC WINDOW CLICK TO CLICK , a,b
                GRAPHIC PRINT a;&quot;,&quot;;b;&quot;          &quot;
                GRAPHIC FONT &quot;Times New Roman&quot;, 14, 1
                SLEEP 200
                GRAPHIC INKEY$ TO i
            IF a >= 85 AND a <= 130 AND b >= 60 AND b <= 100 THEN
                Number = 1
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;&quot;      &quot;
            END IF
            IF a >= 185 AND a <= 230 AND b >= 60 AND b <= 100 THEN
                Number = 2
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;&quot;      &quot;
            END IF
            IF a >= 285 AND a <= 330 AND b >= 60 AND b <= 100 THEN
                Number = 3
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;&quot;      &quot;
            END IF
            IF a >= 385 AND a <= 430 AND b >= 60 AND b <= 100 THEN
                Number = 4
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;&quot;      &quot;
            END IF
            IF a >= 485 AND a <= 530 AND b >= 60 AND b <= 100 THEN
                Number = 5
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;&quot;      &quot;
            END IF
            IF a >= 585 AND a <= 630 AND b >= 60 AND b <= 100 THEN
                Number = 6
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;&quot;      &quot;
            END IF
            IF a >= 685 AND a <= 730 AND b >= 60 AND b <= 100 THEN
                Number = 7
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;&quot;      &quot;
            END IF
            IF a >= 785 AND a <= 830 AND b >= 60 AND b <= 100 THEN
                Number = 8
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;&quot;      &quot;
            END IF
            IF a >= 885 AND a <= 930 AND b >= 60 AND b <= 100 THEN
                Number = 9
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Number;&quot;      &quot;
            END IF
            IF a >= 485 AND a <= 530 AND b >= 10 AND b <= 50 THEN
                Number = 10
                IF Number = 10 THEN Str_Number = &quot;Erase&quot;
                GRAPHIC SET POS(600,5) : GRAPHIC PRINT Str_Number
            END IF
            LOOP UNTIL i = $ESC
            GRAPHIC WINDOW END
        END FUNCTION
        SUB Make_Sudoku_Grid
            LOCAL x,y AS LONG
            GRAPHIC WIDTH 3
            'GRAPHIC BOX (Upper Left horiz corner, Upper Left vert corner)
            '(Lower Right horiz corner, Lower Right vert corner)
            GRAPHIC BOX (300, 150) - (723, 573)
            GRAPHIC LINE (441,573)-(441,150) 'Vert Line 3
            GRAPHIC LINE (582,573)-(582,150) 'Vert Line 6
            GRAPHIC LINE (300,291)-(723,291) 'Horiz line 3
            GRAPHIC LINE (300,432)-(723,432) 'Horiz line 6
            GRAPHIC WIDTH 1
            GRAPHIC LINE (347,573)-(347,150) 'Vert Line 1
            GRAPHIC LINE (394,573)-(394,150) 'Vert Line 2
            GRAPHIC LINE (488,573)-(488,150) 'Vert Line 4
            GRAPHIC LINE (535,573)-(535,150) 'Vert Line 5
            GRAPHIC LINE (629,573)-(629,150) 'Vert Line 7
            GRAPHIC LINE (676,573)-(676,150) 'Vert Line 8
            GRAPHIC LINE (300,197)-(723,197) 'Horiz line 1
            GRAPHIC LINE (300,244)-(723,244) 'Horiz line 2
            GRAPHIC LINE (300,338)-(723,338) 'Horiz line 4
            GRAPHIC LINE (300,385)-(723,385) 'Horiz line 5
            GRAPHIC LINE (300,479)-(723,479) 'Horiz line 7
            GRAPHIC LINE (300,526)-(723,526) 'Horiz line 8
            'Top boxes
            'GRAPHIC BOX (Upper Left horiz corner, Upper Left vert corner)
            '(Lower Right horiz corner, Lower Right vert corner)
            GRAPHIC BOX (81, 5) -  (131, 50),20
            GRAPHIC BOX (181, 5) -  (231, 50),20
            GRAPHIC BOX (481, 5) -  (531, 50),20
            GRAPHIC BOX (881, 5) -  (931, 50),20
            '             horiz,vert
            GRAPHIC SET POS (88,10)  : GRAPHIC PRINT &quot;Erase&quot;
            GRAPHIC SET POS (190,10)  : GRAPHIC PRINT &quot;Load&quot;
            GRAPHIC SET POS (488,10)  : GRAPHIC PRINT &quot;Erase&quot;
            GRAPHIC SET POS (544,10)  : GRAPHIC PRINT &quot;Number =&quot;
            GRAPHIC SET POS (885,10)  : GRAPHIC PRINT &quot; Save&quot;
            GRAPHIC SET POS (88,30)  : GRAPHIC PRINT &quot; File&quot;
            GRAPHIC SET POS (190,30)  : GRAPHIC PRINT &quot; File&quot;
            GRAPHIC SET POS (488,30)  : GRAPHIC PRINT &quot; Num&quot;
            GRAPHIC SET POS (885,30)  : GRAPHIC PRINT &quot;  File&quot;
            y = 131
            FOR x = 1 TO 9
                GRAPHIC BOX (y - 50, 55) -  (y, 105),20
                y = y + 100
            NEXT x
            GRAPHIC SET POS (225,115)
            GRAPHIC FONT &quot;Times New Roman&quot;, 12, 3  ' bold + Italic = (1+2)
            GRAPHIC PRINT &quot;Click on a number then click&quot;;
            GRAPHIC PRINT &quot; on the Sudoku grid to place that number&quot;
            GRAPHIC FONT &quot;Times New Roman&quot;, 18, 1  'points=18,1 = bold
            '                      horiz,vert
            FOR x = 1 TO 9
                GRAPHIC SET POS (x * 100,63) : GRAPHIC PRINT TRIM$(STR$(x))
            NEXT x
            GRAPHIC REDRAW
        END SUB
        SUB SoundBeepBeepBeep  '-------------------- Sound 3 Beeps
            SLEEP 200
            BEEP : SLEEP 150 : BEEP : SLEEP 150 : BEEP : SLEEP 150
        END SUB

        Comment


        • #5
          Here we go again, Error 496 : Destination file write error

          Why do all my quotes in my code show up as '&quot' ?
          TIA, Lynn

          Comment


          • #6
            the forum code tag actually impliments the html pre tag. Just use the quote character for quotes.
            Dale

            Comment

            Working...
            X