Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

File / directory dialog box

brisraybrisray Member Posts: 60
My first ever post to this forum was in the beginning of February and it was to ask for information on Interupts. I didn't get any replies, which is probably just as well, but KDivad Leahcim did remind me of the SHELL command, which I'd forgotten about.

The reason I asked was because I'd had an idea about writing a file dialog box. Well, I finally got round to writing it, and if you're interested you can see the results at http://members.lycos.co.uk/brisray/qbasic/qfdlog.htm

Ray
«1

Comments

  • alan_pollockalan_pollock Member Posts: 110
    Thanks Ray... I'll take a look at it. What was your original question? (never did get a chance to see it)


    : My first ever post to this forum was in the beginning of February and it was to ask for information on Interupts. I didn't get any replies, which is probably just as well, but KDivad Leahcim did remind me of the SHELL command, which I'd forgotten about.
    :
    : The reason I asked was because I'd had an idea about writing a file dialog box. Well, I finally got round to writing it, and if you're interested you can see the results at http://members.lycos.co.uk/brisray/qbasic/qfdlog.htm
    :
    : Ray
    :

  • brisraybrisray Member Posts: 60
    Hi Alan,

    My original post was :-

    If there is anyone to who is willing to explain how to use interupts in QBasic 1.1 to me can they please email me.

    I'm particularly interested in mouse and file routines.

    I'm also interested to know if there is a way of getting file lists into a file or variable. FILES just puts the list onto the screen.

    ***********************************************************
    To tell the truth I'm not surprised I didn't get many replies. It's a huge subject and akin to "teach me programming". It's just something I have never really managed to get my head around.

    What I'm finding is that a lot of the QBasic programs I find that use interupts just don't work properly and produce some weird video effects. A situation I think will get worse as Microsoft moves Windows further away from the DOS environment.

    Ray

  • KDivad LeahcimKDivad Leahcim Member Posts: 3,948
    : Hi Alan,
    :
    : My original post was :-
    :
    : If there is anyone to who is willing to explain how to use interupts in QBasic 1.1 to me can they please email me.
    :
    : I'm particularly interested in mouse and file routines.
    :
    : I'm also interested to know if there is a way of getting file lists into a file or variable. FILES just puts the list onto the screen.
    :
    : ***********************************************************
    : To tell the truth I'm not surprised I didn't get many replies. It's a huge subject and akin to "teach me programming". It's just something I have never really managed to get my head around.
    :
    : What I'm finding is that a lot of the QBasic programs I find that use interupts just don't work properly and produce some weird video effects. A situation I think will get worse as Microsoft moves Windows further away from the DOS environment.
    :
    : Ray
    :
    :

    Very nice! Too bad all I can claim is reminding you of the Shell command.

    DOS 5-7 all look pretty much the same (I think...). QBasic does not affect the output in any way.

    One thing you can look at (you might already have, I didn't check) is the LFN (long file name). If the DOS session is running under Windows, the LFN is appended to the line. You could easily get it similar to your current method of stripping out info. You could then display it somewhere on your dialog. I'd also consider adding the file's size. I can't think that either would add much code.

    Another alternative is to create the dialog in VBDOS. I've done this before and it's fairly easy. I dim a variable and pass the VARSEG and VARPTR values to a VBDOS exe. It runs whatever code it is supposed to and POKEs the new value into that location. Upon returning, QB has the new info.

    Also, VBDOS can make .QLB files that you might be able to use in QB but I've never tried that.
  • brisraybrisray Member Posts: 60
    Thanks KDivad,

    When I wrote that original post I knew there was a way of doing it, but for the life of me couldn't remember what it was.

    I use QBasic 1.1 on a Windows 2000 OS (basically NT).

    When I started writing the program I assumed that what I'd get when I typed DIR > temp.tmp at the command prompt would be the same as when I used SHELL "DIR > temp.tmp" in the program. This isn't what happens. DIR from the command prompt gives long file names, from the SHELL command it gives the old 8.3 format.

    Either QBasic 1.1 has a command processor built into it, or Win 2000 realises the call is coming from a 16 bit program and using a 16 bit version of Dir. Either way, no long file names, not using this method anyway. Getting the file lengths from the file is easy enough, but I want to use that for something else that's going on inside my head at the moment.

    Although I did a fair bit of testing a couple of people have said that the program is locking up when it tries to access an empty B: drive. The error checking I put into it works fine on my machine. I know from other machines I've used that QBasic 1.1 acts a little differently on the various Windows versions. Also, there are three common versions of QBasic in use, 1.1, 4.5 and 7.1, and that these behave a little differetly from eachother too. So I'll blame Microsoft for the program locking up rather than any coding that I did.

    Ray
  • KDivad LeahcimKDivad Leahcim Member Posts: 3,948
    : When I started writing the program I assumed that what I'd get when I typed DIR > temp.tmp at the command prompt would be the same as when I used SHELL "DIR > temp.tmp" in the program. This isn't what happens. DIR from the command prompt gives long file names, from the SHELL command it gives the old 8.3 format.
    :

    Interesting, I was unaware of that. It could be that 2K detects the difference and acts accordingly. I suspect it is likely that cmd.exe (a windows app) loads a DOS-based command interpreter (command.com) and has it load the program. This psuedo-command.com module may be windows-unaware.

    Here's an idea if, as I suspect, %compsec% is set to cmd and not command:

    SHELL ENVIRON$("COMSPEC") + " /c DIR > temp.tmp"

    Essentially, you'd be launching cmd (or command on previous versions of windows) and telling it to create the file.


    Anyway, great work on that code!
  • brisraybrisray Member Posts: 60
    Thanks, that's exactly it.

    I've just checked the environment using SET. Compspec IS set to cmd.exe
    Now I also know how to find the users temporary directory. A bit more file reading and that'll be sorted too.

    It's nice to know all the old DOS stuff I learned on my once almost "state of the art" 8086, an Amstrad 1640 to be precise, is still useful.

    Ray
  • alan_pollockalan_pollock Member Posts: 110
    Ray,

    Looking at the other posts in this thread, I see you've been given some very sound information. As for the DIR command issue, there are still other means to obtain that information (INT21 = hint).

    As for using interrupts in QBasic, there are several excellent referneces (many of them are right here on this board). I'm curious about your comment on the weird video behaviour... what interrupt(s) were you calling?, describe the effect(s).

    Alan


    : Hi Alan,
    :
    : My original post was :-
    :
    : If there is anyone to who is willing to explain how to use interupts in QBasic 1.1 to me can they please email me.
    :
    : I'm particularly interested in mouse and file routines.
    :
    : I'm also interested to know if there is a way of getting file lists into a file or variable. FILES just puts the list onto the screen.
    :
    : ***********************************************************
    : To tell the truth I'm not surprised I didn't get many replies. It's a huge subject and akin to "teach me programming". It's just something I have never really managed to get my head around.
    :
    : What I'm finding is that a lot of the QBasic programs I find that use interupts just don't work properly and produce some weird video effects. A situation I think will get worse as Microsoft moves Windows further away from the DOS environment.
    :
    : Ray
    :
    :

  • brisraybrisray Member Posts: 60
    Using QBasic fullscreen on my my machine (I use v1.1 and Windows 2000) will, more often than not, completely lock QBasic. The machine runs fine but QBasic will not respond at all, and I have to use task manager to close it down. This happens whether or not interupts are being used.

    Windows 2000 is supposed to have better memory protection mamnagement, which usually causes these problems, but seems worse than other versions of Windows I've tried (3.11, 95, 98 and ME).

    I've set the PIF for QBasic to use Protected Mode and to prevent QBasic from recognising Windows which worked well for other Win versions.

    Programs using interupts

    Some programs, especially those that feature the mouse, don't seem to register it properly. The symptoms vary with the program. On some where the mouse X,Y co-ords and button presses are displayed to the screen, the mouse pointer works fine, but the other items don't display properly. On others nothing works at all. On some programs the mouse cursor movement is too jerky and unpredictable to be of use. Other programs cause the mouse pointer to become a little white square. Usually, in these programs, the movement becomes very jerky and odd trails appear. Other times the mouse pointer simply leaves trails. Out of the dozen or so mouse programs I've tried not one works properly.

    Other programs that use interupts in any shape or form cause the screen to become very distorted and lock up. I'm sure you've seen the effect, it looks like as if the screen has been smeared from left to right.

    I'm not too worried about it, I've lived with DOS programs without a mouse long enough. It's just frustrating that I don't know enough about interupts and QBasic to write my own version and see what's going on. It is on my list of things to do, along with the other million or so other items that I either have to do or will do as soon as I find some time.

    Ray
  • KDivad LeahcimKDivad Leahcim Member Posts: 3,948
    : Thanks, that's exactly it.
    :
    : I've just checked the environment using SET. Compspec IS set to cmd.exe
    : Now I also know how to find the users temporary directory. A bit more file reading and that'll be sorted too.
    :
    : It's nice to know all the old DOS stuff I learned on my once almost "state of the art" 8086, an Amstrad 1640 to be precise, is still useful.
    :
    : Ray
    :

    Great! Glad I could help a bit more.

    Seems Microsoft still isn't quite ready to completely eliminate DOS...
  • brisraybrisray Member Posts: 60
    I've just been playing with DOS and the PC environment.

    It doesn't seem to matter whether or not the comspec is set to command.com or cmd.exe

    I've set and reset them both from the command line and from inside QBasic using SHELL. DIR at the DOS prompt will produce the long filenames, from inside QBasic you always get the 8.3 format.

    I also tried using the /N and /X switches from inside QBasic, both came back with error messages saying that the switches were invalid. This leads me to suppose the DIR is being loaded from yet another command processor, one that I'll have a go at tracking down.

    Ray

    A quick DOS lesson, probably not for KDivad or Alan

    You can view the PC environment by using SET at the command prompt
    You can change an environment string from the command prompt by using
    SET=(the string you want to change)
    [No spaces either side of the ='s sign]
    eg to change the comspec line from ComSpec=c:winntsystem32cmd.com
    you can use

    set cpmspec=c:winntsystem32command.com

    I'd be careful changing too much else though, I expect weird things will happen if you change the wrong thing.

    Prompt was always a good one to play with.

    set Prompt=$d $t $g displays the date and time as the DOS prompt

    This will only be effective until the next time the computer is rebooted. The usual default for the prompt is Prompt=Sp$g
«1
Sign In or Register to comment.