We've now changed the "open file" and "save file" routines to include *.lba as a possible file extension.
filedialog "Open file..",filePath$+"*.bas;*.lba",file$
Notice that we can have multiple extensions in a filedialog by separating them with semi-colons. See the FILEDIALOG article above for details on using multiple extensions.
Some routines that worked in Windows95/98 no longer work in WindowsXP, so we'll try to make the Open Source Editor work with all 32-bit versions of Windows.
We previously ran winfile.exe to run the Windows File Manager. Even though this was a Windows 3.1 application, it was also available on later versions of Windows. It is no longer available on Windows XP. We'll now run Windows explorer in LB3, like this:
[winfile] 'change to make XP compatible run "explorer.exe",SHOWNORMAL wait
We run into even more of a problem when trying to run MS Paint. Although
Windows ought to know where to find its own applications, it doesn't seem
to work properly with mspaint. In versions of Windows prior to XP, we could
run "pbrush.exe". This was a 16-bit application, so Win95 and later
had a small "pbrush.exe" program that simply ran MS Paint. Windows
XP no longer has this feature. Simply running "mspaint.exe" doesn't
work in XP, although it does work
(for me!) in Win98. The work-around is to use the SearchTreeForFile API call that was outlined earlier, and find the proper location for mspaint.exe.
Be sure to read the article above about the SearchTreeForFile API call. Here, it is implemented in the Open Source Editor to find mspaint.exe. Notice that if the function cannot find mspaint.exe, the program will not try to run it. Trying to run a non-existant application with the RUN command would cause a program crash. Error trapping is always very important!
[paint] 'change to make XP compatible cursor hourglass RootPath$="c:\" InputPathName$="mspaint.exe" + chr$(0) 'filename only OutputPathBuffer$=space$(1023)+chr$(0)
open "imagehlp" for dll as #ih calldll #ih, "SearchTreeForFile",_ RootPath$ as ptr,_ InputPathName$ as ptr,_ OutputPathBuffer$ as ptr,_ ret as long close #ih
if ret=0 then notice InputPathName$;" not found." else run trim$(OutputPathBuffer$), SHOWNORMAL end if cursor normal wait