Author Topic: BMP picture viewer  (Read 11692 times)

0 Members and 1 Guest are viewing this topic.

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
BMP picture viewer
« on: February 03, 2021, 09:25:35 pm »
Basic code for a BMP picture viewer.  Works with 24 bit per pixel BMP.

Does not use _LOADIMAGE.   To use the program, enter the name of the BMP file you want to look at. 


Code: QB64: [Select]
  1.  
  2. INPUT " Enter name of BMP file "; i$
  3.  
  4. DIM tt AS STRING * 4
  5. DIM t AS STRING * 3
  6. DIM handle AS LONG
  7.  
  8. GET #1, 11, OF
  9. PRINT "Offset to picture data"; OF
  10.  
  11. GET #1, 15, L
  12. PRINT "Header size "; L
  13.  
  14. GET #1, , W
  15. PRINT "image width "; W
  16.  
  17. GET #1, , H
  18. PRINT "image height "; H
  19.  
  20. GET #1, , I
  21.  
  22.  
  23. GET #1, , I
  24. PRINT "bits per pixel "; I
  25.  
  26. IF I = 32 THEN PRINT "Can't process 32 bit per pixel BMP": END
  27.  
  28. handle = _NEWIMAGE(W, H, 32)
  29. a = _MEMIMAGE(handle)
  30.  
  31. FOR R = H - 1 TO 0 STEP -1
  32.  
  33.     FOR C = 1 TO W * 3 STEP 3
  34.         GET #1, R * W * 3 + C + OF, t
  35.         tt = t + CHR$(255)
  36.         _MEMPUT a, a.OFFSET + N, tt
  37.         N = N + 4
  38.     NEXT C
  39.  
  40.  
  41. SCREEN _NEWIMAGE(W, H, 32)
  42. _PUTIMAGE (0, 0), handle
  43.  
  44.  
  45.  








Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: BMP picture viewer
« Reply #1 on: February 03, 2021, 09:36:04 pm »
Will this work with compressed images?

And the only difference with 32-bit images is you just get 4 bytes instead of 3 and adding CHR$(255).
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: BMP picture viewer
« Reply #2 on: February 03, 2021, 09:37:27 pm »
Neat. I'll take a look at this sometime
Shuwatch!

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: BMP picture viewer
« Reply #3 on: February 03, 2021, 09:51:51 pm »
Right now code works with normal uncompressed images .   

Yep adding that 4th byte is important with 24 bit per pixel BMPs 



Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: BMP picture viewer
« Reply #4 on: February 03, 2021, 10:12:52 pm »
Updated so code won't try to open other formats.

Code: QB64: [Select]
  1.  
  2. INPUT " Enter name of BMP file "; i$
  3.  
  4. DIM tt AS STRING * 4
  5. DIM t AS STRING * 3
  6. DIM handle AS LONG
  7.  
  8. GET #1, 11, OF
  9. PRINT "Offset to picture data"; OF
  10.  
  11. GET #1, 15, L
  12. PRINT "Header size "; L
  13.  
  14. GET #1, , W
  15. PRINT "image width "; W
  16.  
  17. GET #1, , H
  18. PRINT "image height "; H
  19.  
  20. GET #1, , I
  21.  
  22.  
  23. GET #1, , I
  24. PRINT "bits per pixel "; I
  25.  
  26. IF I = 32 THEN: _FULLSCREEN: PRINT "Can't process 32 bit per pixel BMP": CLOSE: END
  27. IF I <> 24 THEN: _FULLSCREEN: PRINT "Not a 24 bit per pixel BMP": CLOSE: END
  28.  
  29.  
  30.  
  31.  
  32. handle = _NEWIMAGE(W, H, 32)
  33. a = _MEMIMAGE(handle)
  34.  
  35. FOR R = H - 1 TO 0 STEP -1
  36.  
  37.     FOR C = 1 TO W * 3 STEP 3
  38.         GET #1, R * W * 3 + C + OF, t
  39.         tt = t + CHR$(255)
  40.         _MEMPUT a, a.OFFSET + N, tt
  41.         N = N + 4
  42.     NEXT C
  43.  
  44.  
  45. SCREEN _NEWIMAGE(W, H, 32)
  46. _PUTIMAGE (0, 0), handle
  47.  
  48.  
  49.  












« Last Edit: February 03, 2021, 10:15:24 pm by NOVARSEG »

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: BMP picture viewer
« Reply #5 on: February 04, 2021, 02:38:54 am »
Update

used the FILELIST function to display BMP files in a folder

just click with mouse to display BMP

Code: QB64: [Select]
  1. DIM filename AS STRING
  2. _TITLE "Demo of FILELIST$ Function by Ted Weissgerber 2010 (modified)"
  3. dst& = _NEWIMAGE(800, 600, 32) 'for console bitmap
  4. SCREEN dst&
  5.  
  6. PAINT (799, 599), _RGB(180, 180, 180)
  7. LINE (7, 15)-(648, 496), _RGB(0, 0, 80), BF
  8.  
  9. 'LOCATE 33, 10: PRINT "Do you want file display in a new window? (Y/N)"
  10. 'DO
  11. 'SLEEP
  12. 'yesno$ = UCASE$(INKEY$)
  13. 'LOOP UNTIL yesno$ <> ""
  14.  
  15. 'IF yesno$ = "Y" THEN x% = 0: y% = 0 ELSE x% = 8: y% = 16 'set parameters
  16.  
  17. x% = 8: y% = 16
  18. LOCATE 33, 10
  19. ' INPUT "Enter a File Type extension(*.BMP, *.TXT, etc): ", spec$
  20. 'spec$ = UCASE$(spec$)
  21. ''IF INSTR(spec$, "*.") = 0 THEN spec$ = "*." + spec$
  22. spec$ = "*.bmp"
  23. '<<<<<<< If x% and y% parameters are 0, the display is in separate window.>>>>>>
  24. filename = FILELIST$(spec$, x%, y%) '<<<<<<<< added display position parameters
  25.  
  26.  
  27. LOCATE 35, 10: PRINT filename$, LFN$
  28. 'SLEEP
  29.  
  30.  
  31.  
  32.  
  33. 'END
  34.  
  35. 'INPUT " Enter name of BMP file "; i$
  36. OPEN filename FOR BINARY AS #1
  37.  
  38. DIM tt AS STRING * 4
  39. DIM t AS STRING * 3
  40. DIM handle AS LONG
  41.  
  42. GET #1, 11, OF
  43. PRINT "Offset to picture data"; OF
  44.  
  45. GET #1, 15, L
  46. PRINT "Header size "; L
  47.  
  48. GET #1, , W
  49. PRINT "image width "; W
  50.  
  51. GET #1, , H
  52. PRINT "image height "; H
  53.  
  54. GET #1, , I
  55.  
  56.  
  57. GET #1, , I
  58. PRINT "bits per pixel "; I
  59.  
  60. IF I = 32 THEN: _FULLSCREEN: PRINT "Can't process 32 bit per pixel BMP": CLOSE: END
  61. IF I <> 24 THEN: _FULLSCREEN: PRINT "Not a 24 bit per pixel BMP": CLOSE: END
  62.  
  63.  
  64.  
  65.  
  66. handle = _NEWIMAGE(W, H, 32)
  67. a = _MEMIMAGE(handle)
  68.  
  69. FOR R = H - 1 TO 0 STEP -1
  70.  
  71.     FOR C = 1 TO W * 3 STEP 3
  72.         GET #1, R * W * 3 + C + OF, t
  73.         tt = t + CHR$(255)
  74.         _MEMPUT a, a.OFFSET + N, tt
  75.         N = N + 4
  76.     NEXT C
  77.  
  78.  
  79. SCREEN _NEWIMAGE(W, H, 32)
  80. _PUTIMAGE (0, 0), handle
  81.  
  82.  
  83.  
  84. FUNCTION FILELIST$ (Spec$, xpos%, ypos%)
  85.     SHARED Path$, LFN$ 'values also accessable by program
  86.     REDIM LGFN$(25), SHFN$(25), Last$(25), DIR$(25), Paths$(25) '<<<< $DYNAMIC only
  87.     IF LEN(ENVIRON$("OS")) = 0 THEN EXIT FUNCTION 'DIR X cannot be used on Win 9X
  88.     f% = FREEFILE
  89.     IF xpos% + ypos% = 0 THEN '****************** Root path TITLE in separate window only
  90.         SHELL _HIDE "CD > D0S-DATA.INF"
  91.         OPEN "D0S-DATA.INF" FOR INPUT AS #f%
  92.         LINE INPUT #f%, current$
  93.         CLOSE #f%
  94.     END IF ' ******************************************** END TITLE(see _TITLE below)
  95.     Spec$ = UCASE$(LTRIM$(RTRIM$(Spec$)))
  96.     IF INSTR(Spec$, "/A:D") OR INSTR(Spec$, "/O:G") THEN
  97.         DL$ = "DIR": BS$ = "\" 'directory searches only
  98.     ELSE: DL$ = SPACE$(3): BS$ = ""
  99.     END IF
  100.     mode& = _COPYIMAGE(0) 'save previous screen value to restore if files displayed.
  101.     ' Get Specific file information if available
  102.     SHELL _HIDE "cmd /c dir " + Spec$ + " /X > D0S-DATA.INF" 'get data
  103.     Head$ = "      Short Name          Long Name                     Last Modified     "
  104.     tmp$ = " \ \  \          \   \                              \ \                  \"
  105.     OPEN "D0S-DATA.INF" FOR INPUT AS #f% 'read the data file
  106.     DO UNTIL EOF(f%)
  107.         LINE INPUT #f%, line$
  108.         IF INSTR(line$, ":\") THEN
  109.             Path$ = MID$(line$, INSTR(line$, ":\") - 1)
  110.             IF RIGHT$(Path$, 1) <> "\" THEN Path$ = Path$ + "\"
  111.             setcode% = 0: filecode% = 0
  112.         END IF
  113.         IF LEN(line$) > 25 AND MID$(line$, 1, 1) <> " " THEN 'don't read other info
  114.             IF format% = 0 THEN
  115.                 IF MID$(line$, 20, 1) = "M" OR INSTR(line$, "<") = 25 THEN
  116.                     Sst% = 40: Lst% = 53: Dst% = 26: format% = 1 ' XP
  117.                 ELSE: Sst% = 37: Lst% = 50: Dst% = 23: format% = 2 'VISTA
  118.                 END IF
  119.             END IF
  120.             IF LEN(line$) >= Lst% THEN filecode% = ASC(UCASE$(MID$(line$, Lst%, 1))) ELSE filecode% = 0
  121.             D1R$ = MID$(line$, Dst%, 3) 'returns directories only with Spec$ = "/A:D" or "/O:G"
  122.             IF D1R$ <> "DIR" THEN D1R$ = SPACE$(3) 'change if anything else
  123.             IF D1R$ = DL$ AND filecode% >= setcode% THEN
  124.                 cnt% = cnt% + 1
  125.                 DIR$(cnt%) = D1R$: Paths$(cnt%) = Path$
  126.                 Last$(cnt%) = MID$(line$, 1, 20)
  127.                 IF MID$(line$, Sst%, 1) <> SPACE$(1) THEN
  128.                     SHFN$(cnt%) = MID$(line$, Sst%, INSTR(Sst%, line$, " ") - Sst%)
  129.                     LGFN$(cnt%) = MID$(line$, Lst%)
  130.                 ELSE: SHFN$(cnt%) = MID$(line$, Lst%): LGFN$(cnt%) = ""
  131.                 END IF
  132.                 IF LEN(Spec$) AND (Spec$ = UCASE$(SHFN$(cnt%)) OR Spec$ = UCASE$(LGFN$(cnt%))) THEN
  133.                     Spec$ = SHFN$(cnt%) + BS$: FILELIST$ = Spec$: LFN$ = LGFN$(cnt%) + BS$
  134.                     noshow = -1: GOSUB KILLdata ' verifies file exist query (no display)
  135.                 END IF
  136.                 IF page% > 0 THEN ' pages after first
  137.                     IF cnt% = 1 THEN GOSUB NewScreen
  138.                     COLOR 11: LOCATE , 3: PRINT USING tmp$; DIR$(cnt%); SHFN$(cnt%); LGFN$(cnt%); Last$(cnt%)
  139.                     IF DIR$(cnt%) = "DIR" AND LEFT$(SHFN$(cnt%), 1) = "." THEN SHFN$(cnt%) = "": LGFN$(cnt%) = ""
  140.                 ELSE 'first page = 0
  141.                     IF cnt% = 2 THEN 'only display to screen if 2 or more files are found
  142.                         FList& = _NEWIMAGE(640, 480, 256)
  143.                         IF xpos% + ypos% > 0 THEN ' user wants display on program screen
  144.                             Show& = _NEWIMAGE(640, 480, 256) '<<<<<< ONSCREEN program displays only
  145.                             _DEST FList&
  146.                         ELSE: SCREEN FList& ' <<<<<<<<< Separate Window
  147.                             _TITLE current$ '<<<<<<<<<<<<<<<<<<<<<<<<<<< TITLE optional
  148.                         END IF
  149.                         GOSUB NewScreen '<<<< update function's screen with Putimage(see notes)
  150.                         COLOR 11: LOCATE , 3: PRINT USING tmp$; DIR$(1); SHFN$(1); LGFN$(1); Last$(1)
  151.                         IF DIR$(1) = "DIR" AND LEFT$(SHFN$(1), 1) = "." THEN SHFN$(1) = "": LGFN$(1) = ""
  152.                     END IF
  153.                     IF cnt% > 1 THEN
  154.                         COLOR 11: LOCATE , 3: PRINT USING tmp$; DIR$(cnt%); SHFN$(cnt%); LGFN$(cnt%); Last$(cnt%)
  155.                         IF DIR$(cnt%) = "DIR" AND LEFT$(SHFN$(cnt%), 1) = "." THEN SHFN$(cnt%) = "": LGFN$(cnt%) = ""
  156.                     END IF
  157.                 END IF 'page%
  158.                 IF cnt% MOD 25 = 0 THEN 'each page holds 25 file names
  159.                     COLOR 14: LOCATE 28, 24: PRINT "Select file or click here for next.";
  160.                     GOSUB pickfile
  161.                     page% = page% + 1: cnt% = 0
  162.                     REDIM LGFN$(25), SHFN$(25), Last$(25), DIR$(25), Paths$(25) '<<<< $DYNAMIC only
  163.                 END IF 'mod  25
  164.             END IF 'DIR = DL$
  165.         END IF 'len line$ > 25
  166.     LOOP
  167.     CLOSE #f%
  168.     last = 1: total% = cnt% + (page% * 25)
  169.     IF total% = 0 THEN FILELIST$ = "": Spec$ = "": LFN$ = "": noshow = -1: GOSUB KILLdata: 'no files(no display)
  170.     IF total% = 1 THEN 'one file(no display)
  171.         Spec$ = SHFN$(1) + BS$: FILELIST$ = Spec$: LFN$ = LGFN$(1) + BS$: noshow = -1: GOSUB KILLdata
  172.     END IF
  173.     IF DL$ = SPACE$(3) THEN
  174.         COLOR 10: LOCATE 28, 65: PRINT total%; "Files"
  175.     ELSE: COLOR 10: LOCATE 28, 65: PRINT total%; "Folders"
  176.     END IF
  177.     COLOR 14: LOCATE 28, 24: PRINT "Select file or click here to Exit. ";
  178.     pickfile:
  179.     _DEST FList&
  180.     ShowPath$ = RIGHT$(Path$, 78)
  181.     COLOR 15: LOCATE 29, 41 - (LEN(ShowPath$) \ 2): PRINT ShowPath$;
  182.     GOSUB NewDisplay
  183.     DO: Key$ = UCASE$(INKEY$): _LIMIT 30
  184.         DO WHILE _MOUSEINPUT
  185.             Tcol% = ((_MOUSEX - xpos%) \ 8) + 1 'mouse column with Putimage offset
  186.             Trow% = ((_MOUSEY - ypos%) \ 16) + 1 'mouse row with offset
  187.             Pick = _MOUSEBUTTON(1) ' get left button selection click
  188.         LOOP
  189.         IF Trow% > 2 AND Trow% < cnt% + 3 AND Tcol% > 0 AND Tcol% < 80 THEN 'when mouse in area
  190.             R% = Trow% - 2
  191.             IF P% = 0 OR P% > cnt% + 3 THEN P% = R%
  192.             IF P% = R% THEN
  193.                 COLOR 15: LOCATE R% + 2, 3: PRINT USING tmp$; DIR$(R%); SHFN$(R%); LGFN$(R%); Last$(R%)
  194.             ELSE
  195.                 COLOR 11: LOCATE P% + 2, 3: PRINT USING tmp$; DIR$(P%); SHFN$(P%); LGFN$(P%); Last$(P%)
  196.             END IF
  197.             GOSUB NewDisplay
  198.             P% = R%
  199.             IF Pick THEN
  200.                 Spec$ = SHFN$(R%)
  201.                 IF LEN(Spec$) THEN
  202.                     COLOR 13: LOCATE R% + 2, 3: PRINT USING tmp$; DIR$(R%); SHFN$(R%); LGFN$(R%); Last$(R%)
  203.                     GOSUB NewDisplay
  204.                     Spec$ = Spec$ + BS$: FILELIST$ = Spec$: Path$ = Paths$(R%)
  205.                     IF LEN(LGFN$(R%)) THEN LFN$ = LGFN$(R%) + BS$ ELSE LFN$ = ""
  206.                     _DELAY 1.5: CLS: SCREEN mode&: GOSUB KILLdata 'exit if user selection
  207.                 END IF
  208.             END IF 'len spec
  209.         END IF 'pick
  210.         IF LEN(Key$) THEN usercode% = ASC(Key$) ELSE usercode% = 0
  211.         IF usercode% > setcode% THEN setcode% = usercode% 'user can press letter to jump to
  212.         IF Pick AND Trow% > 27 THEN EXIT DO
  213.     LOOP UNTIL LEN(Key$)
  214.     _DELAY .4 'adjust delay for page scroll speed
  215.     DO: Key$ = INKEY$: LOOP UNTIL Key$ = ""
  216.     IF last = 0 THEN RETURN 'exit if file no more data
  217.     FILELIST$ = "": Spec$ = "": LFN$ = ""
  218.     CLS: SCREEN mode& 'resets program screen to previous condition
  219.     KILLdata:
  220.     CLOSE #f%: KILL "D0S-DATA.INF" 'kill D0S-DATA.INF file and exit
  221.     IF FList& < -1 THEN _FREEIMAGE FList&
  222.     IF Show& < -1 THEN _FREEIMAGE Show&
  223.     IF noshow = -1 AND mode& < -1 THEN _FREEIMAGE mode&
  224.     _AUTODISPLAY 'reset default settings
  225.     RETURN
  226.     NewScreen: 'clear screen and set display format
  227.     LINE (0, 0)-(639, 499), 0, BF
  228.     COLOR 14: LOCATE 2, 3: PRINT Head$
  229.     LINE (4, 4)-(636, 476), 13, B: LINE (5, 5)-(635, 475), 13, B
  230.     GOSUB NewDisplay
  231.     RETURN
  232.     NewDisplay: 'show program or window displays
  233.     IF xpos% + ypos% > 0 THEN
  234.         _PUTIMAGE , FList&, Show&
  235.         _DEST 0: _PUTIMAGE (xpos%, ypos%), Show&: _DISPLAY
  236.         _DEST FList&
  237.     ELSE: _DISPLAY
  238.     END IF
  239.     RETURN
  240.  






« Last Edit: February 04, 2021, 01:38:12 pm by NOVARSEG »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: BMP picture viewer
« Reply #6 on: February 04, 2021, 02:06:59 pm »
@NOVARSEG

OK you fixed the first error on title but I am still getting path not found line 39

Code: QB64: [Select]
  1. spec$ = "*.*"
  2. '<<<<<<< If x% and y% parameters are 0, the display is in separate window.>>>>>>
  3. filename = FILELIST$(spec$, x%, y%) '<<<<<<<< added display position parameters
  4.  

so filename is missing, so maybe it's the spec$, changed to "*.*" takes care of that error (when no .bmp file is found) and what a lovely display Ted W! from 2010 but then I want to try another directory for bmp files I click where it says to change directory error again. I click current folder to change that and another error.
Not fun... :(

There is a tool to get Folders and Files that works cross platform from which you could work out file select or Folder change Best Answer here: https://www.qb64.org/forum/index.php?topic=1511.msg107143#msg107143

You would build your own filter for BMP files and the code for displaying the Directory Lists and File Lists, it's good exercise and you explain your code better to others and fix errors. There are also tools for displaying lists and selecting also probably harder to do than getting Folder and File lists.

Just trying to help, I don't save BMP's in this format but you are attempting a very common and useful task browsing for filename to load. It is important.

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: BMP picture viewer
« Reply #7 on: February 04, 2021, 06:37:15 pm »
@bplus
The code is buggy

When I paste a single bmp into a folder  or no BMP in folder it crashes

When  I paste 2 bmp into a folder it works.


Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: BMP picture viewer
« Reply #8 on: February 04, 2021, 07:28:53 pm »
@NOVARSEG  buggy program is OK, just a little warning first please. Sorry I thought you were showing a demo.

I still recommend using someone else filename retriever, not Ted W from 2010. Someone here and now at forum that can help with code they wrote if you get stuck while using.

Steve has good filename retriever, Spriggsy, Dav... not just me to choose more current code from.

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: BMP picture viewer
« Reply #9 on: February 04, 2021, 07:40:31 pm »
The code is a demo used with BMP viewer. 

 Followed that link  https://www.qb64.org/forum/index.php?topic=1511.msg107143#msg107143 and found the code with library functions.   I have also done the same thing with the DOS interrupts.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: BMP picture viewer
« Reply #10 on: February 04, 2021, 07:49:23 pm »
The code is a demo used with BMP viewer. 

 Followed that link  https://www.qb64.org/forum/index.php?topic=1511.msg107143#msg107143 and found the code with library functions.   I have also done the same thing with the DOS interrupts.

The advantage of using code from that link is that it is cross platform not Windows dependent so build a filename retriever from that and it can be used in Linux and Mac (so I hear). And reused for any app that needs to get a filename.

But maybe those other OS don't use that form of BMP. :)

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: BMP picture viewer
« Reply #11 on: February 04, 2021, 09:45:47 pm »
The BMP format is cross platform. It's disadvantage is size of file.

Im trying to work with win API.  I'm trying to download  fileapi.h  not much luck so far.

https://docs.microsoft.com/en-us/windows/win32/api/fileapi/

Are you actually clicking the file name with mouse?

Microsoft recommends C++ when coding with WINAPI 
https://docs.microsoft.com/en-us/windows/win32/learnwin32/learn-to-program-for-windows

Can we do the same with QB64?
« Last Edit: February 04, 2021, 09:51:15 pm by NOVARSEG »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: BMP picture viewer
« Reply #12 on: February 04, 2021, 10:24:16 pm »
The BMP format is cross platform. It's disadvantage is size of file.

Im trying to work with win API.  I'm trying to download  fileapi.h  not much luck so far.

https://docs.microsoft.com/en-us/windows/win32/api/fileapi/

Are you actually clicking the file name with mouse?

Microsoft recommends C++ when coding with WINAPI 
https://docs.microsoft.com/en-us/windows/win32/learnwin32/learn-to-program-for-windows

Can we do the same with QB64?

Windows API isn't going to help you in Linux.

Here is Tiny Navigator for File Retrieval, you need direntry.h in the same folder as QB64.exe.

Tiny Navigator for File Retrieval the left side is directories, the right is a sample of files from the directory highlighted. When on the directory you want to select a file from press f then another scrollable window comes up on right for file selection.

You can scroll, arrow, pageup and down by clicking green bars home end for start of array and end, you can also select directories and files by typing the number then enter.
Code: QB64: [Select]
  1. ' B+ started 2019-08-22  restart 2020-06-24
  2. ' 2019-08-22 orig post at https://www.qb64.org/forum/index.php?topic=1646.msg108682#msg108682
  3. ' 2019-08-23_13-25 try fix (to nav all directories) with one place for tmpFile, theory can't write files in some dir's
  4. ' For some reason Windows won't write to a fully pathed file in my user folder???from a SHELL command
  5. ' Try testing if dir exists "C:\temp" exists and making one if not, yes! and I can write my temp files there
  6. ' and now I can chDir anywhere!!!!
  7. ' 2019-08-23_14-25 Take Steve's Advice to use users tmp directory for temp files
  8. ' 2019-08-23_23+ Have files window working for file selection
  9.  
  10. ' 2020-06-24 restart using DirEntry.h, wow looks like Steve's fix helped ALLOT! Thanks SMcNeill
  11. ' I am hitting glitches where Windows wont let me access I think. So I am offering a c enter option
  12. ' to restart at the root but this might not work cross platform.
  13.  
  14. ' 2020-06-26 another fix to DirEntry.h usage add CHR$(0) to string when calling a C program. This fixed a snag
  15. ' between marka and next folder up when heading to root with .. calls.
  16.  
  17. ' 2020-07-04 Use this to Kill some pesky .ogg files
  18.  
  19. ' direntry.h needs to be in QB64 folder ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< IMPORTANT
  20.     FUNCTION load_dir& (s AS STRING)
  21.     FUNCTION has_next_entry& ()
  22.     SUB close_dir ()
  23.     SUB get_next_entry (s AS STRING, flags AS LONG, file_size AS LONG)
  24.  
  25.  
  26. _TITLE "Tiny Navigator File Name Retriever:  press f to start File Selection List of current directory"
  27. SCREEN _NEWIMAGE(1000, 600, 32)
  28. _SCREENMOVE 100, 50
  29.  
  30. ' for GetFileName$()
  31. DIM SHARED selectedFile AS STRING
  32. REDIM SHARED DIRs(0) AS STRING, FILs(0) AS STRING
  33.  
  34. DIM done, myFile$, again$
  35. COLOR &HFF000000, &HFFFFFFFF
  36. DO 'test our new function
  37.     scnState 0
  38.     myFile$ = GetFileName$
  39.     scnState -1
  40.     CLS
  41.     PRINT "You selected: "; myFile$
  42.     PRINT
  43.     INPUT "Test another File Selection (y for yes) "; again$
  44.     IF again$ <> "y" THEN done = -1
  45. LOOP UNTIL done
  46.  
  47. FUNCTION GetFileName$ ()
  48.  
  49.     'you might try srnState before and after calling this function to restore conditions
  50.     ' uses: SUB GetLists (SearchDirectory AS STRING, DirList() AS STRING, FileList() AS STRING)  for getting dirs a nd files
  51.     ' uses: FUNCTION getArrayItemNumber& (locateRow, locateColumn, boxWidth, boxHeight, arr() AS STRING) for display large arrays and selecting
  52.  
  53.     ' share these with Main Code section:
  54.     ' 'for GetFileName$() and GetLists
  55.     'DIM SHARED selectedFile AS STRING
  56.     'REDIM SHARED DIRs(0) AS STRING, FILs(0) AS STRING
  57.  
  58.     DIM mySelection&, done$, i, t$
  59.  
  60.     _TITLE "Tiny Navigator File Name Retriever:  press f to start File Selection List of current directory"
  61.     DO
  62.         COLOR _RGB32(180, 180, 255), &HFF000000
  63.         CLS
  64.         t$ = "Current Directory: " + _CWD$
  65.         LOCATE 2, (_WIDTH / 8 - LEN(t$)) / 2: PRINT t$
  66.         REDIM DIRs(0) AS STRING, FILs(0) AS STRING
  67.         GetLists _CWD$, DIRs(), FILs()
  68.         FOR i = 0 TO UBOUND(FILs) ' this just offers a sample listing of files
  69.             IF i < 30 THEN LOCATE i + 4, 60: PRINT FILs(i) ELSE EXIT FOR
  70.         NEXT
  71.         mySelection& = getArrayItemNumber&(5, 5, 50, 30, DIRs())
  72.  
  73.         CLS
  74.         IF selectedFile <> "" THEN
  75.             GetFileName$ = selectedFile: done$ = "y"
  76.         ELSEIF mySelection& <> -1719 THEN
  77.             IF _TRIM$(DIRs(mySelection&)) <> "" THEN
  78.                 CHDIR DIRs(mySelection&)
  79.             END IF
  80.         ELSE
  81.             GetFileName$ = "": done$ = "y" ' cancelled or error
  82.         END IF
  83.         selectedFile = ""
  84.         _LIMIT 60
  85.     LOOP UNTIL done$ <> ""
  86.  
  87. SUB GetLists (SearchDirectory AS STRING, DirList() AS STRING, FileList() AS STRING)
  88.  
  89.     'put this block in main code section of your program close to top
  90.     '' direntry.h needs to be in QB64 folder
  91.     'DECLARE CUSTOMTYPE LIBRARY ".\direntry"
  92.     '    FUNCTION load_dir& (s AS STRING)
  93.     '    FUNCTION has_next_entry& ()
  94.     '    SUB close_dir ()
  95.     '    SUB get_next_entry (s AS STRING, flags AS LONG, file_size AS LONG)
  96.     'END DECLARE
  97.  
  98.  
  99.     CONST IS_DIR = 1
  100.     CONST IS_FILE = 2
  101.     DIM flags AS LONG, file_size AS LONG, DirCount AS INTEGER, FileCount AS INTEGER, length AS LONG
  102.     DIM nam$
  103.     REDIM _PRESERVE DirList(100), FileList(100)
  104.     DirCount = 0: FileCount = 0
  105.  
  106.     IF load_dir(SearchDirectory + CHR$(0)) THEN
  107.         DO
  108.             length = has_next_entry
  109.             IF length > -1 THEN
  110.                 nam$ = SPACE$(length)
  111.                 get_next_entry nam$, flags, file_size
  112.                 IF (flags AND IS_DIR) THEN
  113.                     DirCount = DirCount + 1
  114.                     IF DirCount > UBOUND(DirList) THEN REDIM _PRESERVE DirList(UBOUND(DirList) + 100)
  115.                     DirList(DirCount) = nam$
  116.                 ELSEIF (flags AND IS_FILE) THEN
  117.                     FileCount = FileCount + 1
  118.                     IF FileCount > UBOUND(filelist) THEN REDIM _PRESERVE FileList(UBOUND(filelist) + 100)
  119.                     FileList(FileCount) = nam$
  120.                 END IF
  121.             END IF
  122.         LOOP UNTIL length = -1
  123.         'close_dir 'move to after end if  might correct the multi calls problem
  124.     ELSE
  125.     END IF
  126.     close_dir 'this  might correct the multi calls problem
  127.  
  128.     REDIM _PRESERVE DirList(DirCount)
  129.     REDIM _PRESERVE FileList(FileCount)
  130.  
  131. FUNCTION rightOf$ (source$, of$)
  132.     IF INSTR(source$, of$) > 0 THEN rightOf$ = MID$(source$, INSTR(source$, of$) + LEN(of$))
  133.  
  134. ' "Escape or Red X box returns -1719 to allow a Cancel function and signal no slection."
  135. FUNCTION getArrayItemNumber& (locateRow, locateColumn, boxWidth, boxHeight, arr() AS STRING)
  136.     'Notes: locateRow, locateColumn for top right corner of selection box on screen in characters for LOCATE.
  137.     'boxWidth and boxHeight are in character units, again for locate and print at correct places.
  138.     'All displaying is restricted to inside the box, which has PgUP and PgDn as top and bottom lines in the display.
  139.  
  140.     DIM curRow AS INTEGER, curCol AS INTEGER, fg AS _UNSIGNED LONG, bg AS _UNSIGNED LONG
  141.     DIM maxWidth AS INTEGER, maxHeight AS INTEGER, page AS INTEGER, hlite AS INTEGER, mx AS INTEGER, my AS INTEGER
  142.     DIM lastMX AS INTEGER, lastMY AS INTEGER, row AS INTEGER, mb AS INTEGER
  143.     DIM lba AS LONG, uba AS LONG, choice AS LONG, kh AS LONG, index AS LONG
  144.     DIM clrStr AS STRING, b AS STRING, selNum&
  145.  
  146.     'save old settings to restore at end ofsub
  147.     curRow = CSRLIN
  148.     curCol = POS(0)
  149.     fg = _DEFAULTCOLOR
  150.     bg = _BACKGROUNDCOLOR
  151.     _KEYCLEAR
  152.  
  153.     maxWidth = boxWidth '       number of characters in box
  154.     maxHeight = boxHeight - 2 ' number of lines displayed of array at one time = 1 page
  155.     lba = LBOUND(arr)
  156.     uba = UBOUND(arr)
  157.     page = 0
  158.     hlite = 0 '                 line in display ready for selection by spacebar or if no number is started, enter
  159.     clrStr$ = SPACE$(maxWidth) 'clearing a display line
  160.  
  161.     GOSUB update '              show the beginning of the array items for selection
  162.  
  163.     'signal cancel selection process, exit sub with this unlikely index to signal canel
  164.     choice = -1719 'primes 7 and 8, not likely to be a select index of an array
  165.  
  166.     DO 'until get a selection or demand exit
  167.  
  168.         'handle the key stuff
  169.         kh& = _KEYHIT
  170.         IF kh& THEN
  171.             IF kh& > 0 AND kh& < 255 THEN
  172.                 IF INSTR("0123456789", CHR$(kh&)) > 0 THEN b$ = b$ + CHR$(kh&): GOSUB update
  173.                 IF CHR$(kh&) = "f" THEN
  174.                     'REDIM FILs(0) AS STRING     'hopefully this is already ready
  175.                     'loadFiles FILs()
  176.                     selNum& = getArrayItemNumber&(5, 60, 60, 30, FILs())
  177.                     COLOR _RGB32(180, 180, 255)
  178.                     CLS 'need to signal out of file selection
  179.                     IF selNum& >= LBOUND(FILs) AND selNum& <= UBOUND(FILs) THEN selectedFile = FILs(selNum&)
  180.                     EXIT DO
  181.                     'back to directory select
  182.                 END IF
  183.  
  184.                 IF CHR$(kh&) = "c" THEN b$ = "": GOSUB update
  185.                 IF kh& = 13 THEN 'enter pressed check if number is being entered?
  186.                     IF LEN(b$) THEN
  187.                         IF VAL(b$) >= lba AND VAL(b$) <= uba THEN 'we have number started
  188.                             choice = VAL(b$): EXIT DO
  189.                         ELSE 'clear b$ to show some response to enter
  190.                             b$ = "": GOSUB update 'clear the value that doesn't work
  191.                         END IF
  192.                     ELSE
  193.                         choice = hlite + page * maxHeight + lba 'must mean to select the highlighted item
  194.                     END IF
  195.                 END IF
  196.                 IF kh& = 27 THEN EXIT DO 'escape clause offered to Cancel selection process
  197.                 IF kh& = 32 THEN choice = hlite + page * maxHeight + lba 'best way to choose highlighted selection
  198.                 IF kh& = 8 THEN 'backspace to edit number
  199.                     IF LEN(b$) THEN b$ = LEFT$(b$, LEN(b$) - 1): GOSUB update
  200.                 END IF
  201.             ELSE
  202.                 SELECT CASE kh& 'choosing sections of array to display and highlighted item
  203.                     CASE 20736 'pg dn
  204.                         IF (page + 1) * maxHeight + lba <= uba THEN page = page + 1: GOSUB update
  205.                     CASE 18688 'pg up
  206.                         IF (page - 1) * maxHeight + lba >= lba THEN page = page - 1: GOSUB update
  207.                     CASE 18432 'up
  208.                         IF hlite - 1 < 0 THEN
  209.                             IF page > 0 THEN
  210.                                 page = page - 1: hlite = maxHeight - 1: GOSUB update
  211.                             END IF
  212.                         ELSE
  213.                             hlite = hlite - 1: GOSUB update
  214.                         END IF
  215.                     CASE 20480 'down
  216.                         IF (hlite + 1) + page * maxHeight + lba <= uba THEN 'ok to move up
  217.                             IF hlite + 1 > maxHeight - 1 THEN
  218.                                 page = page + 1: hlite = 0: GOSUB update
  219.                             ELSE
  220.                                 hlite = hlite + 1: GOSUB update
  221.                             END IF
  222.                         END IF
  223.                     CASE 18176 'home
  224.                         page = 0: hlite = 0: GOSUB update
  225.                     CASE 20224 ' end
  226.                         page = INT((uba - lba) / maxHeight): hlite = maxHeight - 1: GOSUB update
  227.                 END SELECT
  228.             END IF
  229.         END IF
  230.  
  231.         'handle the mouse stuff
  232.         WHILE _MOUSEINPUT
  233.             IF _MOUSEWHEEL = -1 THEN 'up?
  234.                 IF hlite - 1 < 0 THEN
  235.                     IF page > 0 THEN
  236.                         page = page - 1: hlite = maxHeight - 1: GOSUB update
  237.                     END IF
  238.                 ELSE
  239.                     hlite = hlite - 1: GOSUB update
  240.                 END IF
  241.             ELSEIF _MOUSEWHEEL = 1 THEN 'down?
  242.                 IF (hlite + 1) + page * maxHeight + lba <= uba THEN 'ok to move up
  243.                     IF hlite + 1 > maxHeight - 1 THEN
  244.                         page = page + 1: hlite = 0: GOSUB update
  245.                     ELSE
  246.                         hlite = hlite + 1: GOSUB update
  247.                     END IF
  248.                 END IF
  249.             END IF
  250.         WEND
  251.         mx = INT((_MOUSEX - locateColumn * 8) / 8) + 2: my = INT((_MOUSEY - locateRow * 16) / 16) + 2
  252.         IF _MOUSEBUTTON(1) THEN 'click contols or select array item
  253.             'clear mouse clicks
  254.             mb = _MOUSEBUTTON(1)
  255.             IF mb THEN 'clear it
  256.                 WHILE mb 'OK!
  257.                     IF _MOUSEINPUT THEN mb = _MOUSEBUTTON(1)
  258.                     _LIMIT 100
  259.                 WEND
  260.             END IF
  261.  
  262.             IF mx >= 1 AND mx <= maxWidth AND my >= 1 AND my <= maxHeight THEN
  263.                 choice = my + page * maxHeight + lba - 1 'select item clicked
  264.             ELSEIF mx >= 1 AND mx <= maxWidth AND my = 0 THEN 'page up or exit
  265.                 IF my = 0 AND (mx <= maxWidth AND mx >= maxWidth - 2) THEN 'exit sign
  266.                     EXIT DO 'escape plan for mouse click top right corner of display box
  267.                 ELSE 'PgUp bar clicked
  268.                     IF (page - 1) * maxHeight + lba >= lba THEN page = page - 1: GOSUB update
  269.                 END IF
  270.             ELSEIF mx >= 1 AND mx <= maxWidth AND my = maxHeight + 1 THEN 'page down bar clicked
  271.                 IF (page + 1) * maxHeight + lba <= uba THEN page = page + 1: GOSUB update
  272.             END IF
  273.         ELSE '   mouse over highlighting, only if mouse has moved!
  274.             IF mx >= 1 AND mx <= maxWidth AND my >= 1 AND my <= maxHeight THEN
  275.                 IF mx <> lastMX OR my <> lastMY THEN
  276.                     IF my - 1 <> hlite AND (my - 1 + page * maxHeight + lba <= uba) THEN
  277.                         hlite = my - 1
  278.                         lastMX = mx: lastMY = my
  279.                         GOSUB update
  280.                     END IF
  281.                 END IF
  282.             END IF
  283.         END IF
  284.         _LIMIT 200
  285.     LOOP UNTIL choice >= lba AND choice <= uba
  286.     getArrayItemNumber& = choice
  287.     COLOR fg, bg
  288.     'clear key presses
  289.     _KEYCLEAR
  290.     LOCATE curRow, curCol
  291.     'clear mouse clicks
  292.     mb = _MOUSEBUTTON(1)
  293.     IF mb THEN 'clear it
  294.         WHILE mb 'OK!
  295.             IF _MOUSEINPUT THEN mb = _MOUSEBUTTON(1)
  296.             _LIMIT 100
  297.         WEND
  298.     END IF
  299.     EXIT SUB
  300.  
  301.     update: '--------------- display of array sections and controls on screen
  302.  
  303.     'fix hlite if it has dropped below last array item
  304.     WHILE hlite + page * maxHeight + lba > uba
  305.         hlite = hlite - 1
  306.     WEND
  307.  
  308.     'main display of array items at page * maxHeight (lines high)
  309.     FOR row = 0 TO maxHeight - 1
  310.         IF hlite = row THEN COLOR _RGB(200, 200, 255), _RGB32(0, 0, 88) ELSE COLOR _RGB32(0, 0, 88), _RGB(200, 200, 255)
  311.         LOCATE locateRow + row, locateColumn: PRINT clrStr$
  312.         index = row + page * maxHeight + lba
  313.         IF index >= lba AND index <= uba THEN
  314.             LOCATE locateRow + row, locateColumn
  315.             PRINT LEFT$(LTRIM$(STR$(index)) + ") " + arr(index), maxWidth)
  316.         END IF
  317.     NEXT
  318.  
  319.     'make page up and down bars to click, print PgUp / PgDn if available
  320.     COLOR _RGB32(200, 200, 255), _RGB32(0, 100, 50)
  321.     LOCATE locateRow - 1, locateColumn: PRINT SPACE$(maxWidth)
  322.     IF page <> 0 THEN LOCATE locateRow - 1, locateColumn: PRINT LEFT$(" Pg Up" + SPACE$(maxWidth), maxWidth)
  323.     LOCATE locateRow + maxHeight, locateColumn: PRINT SPACE$(maxWidth)
  324.     IF page <> INT(uba / maxHeight) THEN
  325.         LOCATE locateRow + maxHeight, locateColumn: PRINT LEFT$(" Pg Dn" + SPACE$(maxWidth), maxWidth)
  326.     END IF
  327.     'make exit sign for mouse click
  328.     COLOR _RGB32(255, 255, 255), _RGB32(200, 100, 0)
  329.     LOCATE locateRow - 1, locateColumn + maxWidth - 3
  330.     PRINT " X "
  331.  
  332.     'if a number selection has been started show it's build = b$
  333.     IF LEN(b$) THEN
  334.         COLOR _RGB(255, 255, 0), _RGB32(0, 0, 0)
  335.         LOCATE locateRow + maxHeight, locateColumn + maxWidth - LEN(b$) - 1
  336.         PRINT b$;
  337.     END IF
  338.     _DISPLAY
  339.     _LIMIT 100
  340.     RETURN
  341.  
  342. ' for saving and restoring screen settins
  343. SUB scnState (restoreTF AS INTEGER) 'Thanks Steve McNeill
  344.     STATIC Font AS LONG, DefaultColor AS _UNSIGNED LONG, BackGroundColor AS _UNSIGNED LONG, Dest AS LONG, Source AS LONG
  345.     STATIC row AS INTEGER, col AS INTEGER, autodisplay AS INTEGER, mb AS INTEGER
  346.     IF restoreTF THEN
  347.         _FONT Font
  348.         COLOR DefaultColor, BackGroundColor
  349.         _DEST Dest
  350.         _SOURCE Source
  351.         LOCATE row, col
  352.         IF autodisplay THEN _AUTODISPLAY ELSE _DISPLAY
  353.         _KEYCLEAR
  354.         WHILE _MOUSEINPUT: WEND 'clear mouse clicks
  355.         mb = _MOUSEBUTTON(1)
  356.         IF mb THEN
  357.             DO
  358.                 WHILE _MOUSEINPUT: WEND
  359.                 mb = _MOUSEBUTTON(1)
  360.                 _LIMIT 100
  361.             LOOP UNTIL mb = 0
  362.         END IF
  363.     ELSE
  364.         Font = _FONT: DefaultColor = _DEFAULTCOLOR: BackGroundColor = _BACKGROUNDCOLOR
  365.         Dest = _DEST: Source = _SOURCE
  366.         row = CSRLIN: col = POS(0): autodisplay = _AUTODISPLAY
  367.     END IF
  368.  
  369.  

You will have to test the selected file for the proper extension.
* direntry.h (Filesize: 1.21 KB, Downloads: 125)
« Last Edit: February 04, 2021, 10:32:15 pm by bplus »

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: BMP picture viewer (slide show)
« Reply #13 on: February 05, 2021, 02:49:04 am »
BMP slide show.  Copy the 4 attached files into a folder to make this work. (3 BMP images and 1 EXE)

Here is the source code BAS file

Code: QB64: [Select]
  1. _TITLE "BMP slide show.   Press ESC to exit"
  2.  
  3.  
  4.     FUNCTION load_dir& (s AS STRING)
  5.     FUNCTION has_next_entry& ()
  6.     SUB close_dir ()
  7.     SUB get_next_entry (s AS STRING, flags AS LONG, file_size AS LONG)
  8.  
  9. DIM flags AS LONG
  10. DIM length AS LONG
  11. DIM F(100) AS STRING
  12. DIM Fcount AS INTEGER
  13. DIM tt AS STRING * 4
  14. DIM t AS STRING * 3
  15. DIM handle AS LONG
  16.  
  17. IF load_dir("." + CHR$(0)) = -1 THEN 'found "." this is a folder  not a root drive
  18.  
  19.     DO
  20.         length = has_next_entry
  21.         IF length = -1 THEN
  22.             '_FULLSCREEN
  23.             PRINT "NO more files to process"
  24.             EXIT DO
  25.         END IF
  26.  
  27.         IF length > -1 THEN
  28.             NAM$ = SPACE$(length)
  29.             get_next_entry NAM, flags, file_size
  30.  
  31.             IF (flags XOR 2) = 0 AND UCASE$(RIGHT$(NAM, 3)) = "BMP" THEN
  32.                 PRINT NAM + "                  "
  33.                 Fcount = Fcount + 1
  34.                 F(Fcount) = NAM
  35.             END IF
  36.  
  37.         END IF
  38.  
  39.     LOOP
  40.     Fmax = Fcount
  41.  
  42. END IF ''''IF load_dir("." + CHR$(0)) = -1 THEN
  43.  
  44. close_dir '
  45.  
  46.  
  47. Fcount = 0
  48.  
  49.     N = 0
  50.  
  51.     Fcount = Fcount + 1
  52.     OPEN F(Fcount) FOR BINARY AS #1
  53.     IF Fcount = Fmax THEN Fcount = 0
  54.  
  55.     GET #1, 11, OF
  56.     'PRINT "Offset to picture data"; OF
  57.  
  58.     GET #1, 15, L
  59.     ' PRINT "Header size "; L
  60.  
  61.     GET #1, , W
  62.     ' PRINT "image width "; W
  63.  
  64.     GET #1, , H
  65.     'PRINT "image height "; H
  66.  
  67.     GET #1, , I
  68.  
  69.  
  70.     GET #1, , I
  71.     ' PRINT "bits per pixel "; I
  72.     'PRINT
  73.  
  74.     IF I = 32 THEN: _FULLSCREEN: PRINT "Can't process 32 bit per pixel BMP": CLOSE: GOTO LL1
  75.     IF I <> 24 THEN PRINT "Not a 24 bit per pixel BMP": CLOSE: GOTO LL1
  76.  
  77.     DIM a AS _MEM
  78.     handle = _NEWIMAGE(W, H, 32)
  79.     a = _MEMIMAGE(handle)
  80.  
  81.  
  82.  
  83.     FOR R = H - 1 TO 0 STEP -1
  84.  
  85.         FOR C = 1 TO W * 3 STEP 3
  86.             GET #1, R * W * 3 + C + OF, t
  87.             tt = t + CHR$(255)
  88.             _MEMPUT a, a.OFFSET + N, tt
  89.             N = N + 4
  90.         NEXT C
  91.  
  92.     NEXT R
  93.  
  94.     SCREEN _NEWIMAGE(W, H, 32)
  95.     _PUTIMAGE (0, 0), handle
  96.     _MEMFREE a
  97.  
  98.     LL1:
  99.     t1 = TIMER
  100.     DO
  101.         _LIMIT 100
  102.         t2 = TIMER
  103.         IF t2 - t1 >= 2 THEN EXIT DO
  104.         i$ = INKEY$
  105.         IF i$ = CHR$(27) THEN END
  106.     LOOP
  107.     CLOSE
  108.  
  109.  

OK there is the pics hmm not much use for the program if you can see the pics ????











* ss5.bmp (Filesize: 1.5 MB, Dimensions: 1024x512, Views: 359)

* engine.bmp (Filesize: 2.25 MB, Dimensions: 1024x768, Views: 359)

* HalletsPeakROMO_npsphoto.bmp (Filesize: 2.18 MB, Dimensions: 1072x712, Views: 368)
* picviewRAW.exe (Filesize: 1.65 MB, Downloads: 128)
« Last Edit: February 05, 2021, 03:12:26 am by NOVARSEG »

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: BMP picture viewer
« Reply #14 on: February 05, 2021, 11:54:05 am »
Works for me here.  Nice to see someone latch onto an programming idea and not stop till it gets done.

- Dav