Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Qbasic and the CTRL+C command  (Read 6114 times)

0 Members and 1 Guest are viewing this topic.

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Qbasic and the CTRL+C command
« on: July 16, 2007, 01:27:15 AM »
Mmm, 1988 programming

Is there a way to make it so that the CTRL+C command will not allow a Qbasic program to close?
I know it sounds menacing, but its not.

The program I was writing (for some reason, it wont load, so now I have to rewrite it  :-\) asks a user for the password to access a system.

If a user didn't have a password (right now, for my current version) they can press CTRL+C to bypass it.

(^^ Yes, this is one of my lame programs that I created for no reason, except for the fact that I am bored^^)

(And my solution for not using loops: Goto commands mixed with IF-THEN statements)

Dusty



    Egghead

  • I could if she would, but she won't so I don't.
  • Thanked: 75
  • Experience: Beginner
  • OS: Windows XP
Re: Qbasic and the CTRL+C command
« Reply #1 on: July 16, 2007, 03:15:02 AM »
You can tailor the content of NoBreak.zip from the Miscellaneous section on this site, but don't forget to include some method of terminating the program.

Good luck
One good deed is worth more than a year of good intentions.

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: Qbasic and the CTRL+C command
« Reply #2 on: July 16, 2007, 08:30:44 PM »
Documentation:

So you forgot your password, and you need a way out of it:
Press the following keys, in order:
CTRL+C+D+TAB+SHIFT
(These keys can be pressed by this order: Pinky on TAB, That one finger on D, Ring on C, and thumb on SHIFT and CTRL)
As you are holding this down, start typing the following text:
"India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great India Is Great "
and press ENTER

The CONF$ data will be reset, and the next time you restart your computer, it will allow you to enter a new password.




Another question for you experts:
How could I make a key combination activate a sub or GOTO command, for example:
If I wanted CTRL+H to give the command
Code: [Select]
goto help    or   
Code: [Select]
call helphow would I go about doing that?

Dusty



    Egghead

  • I could if she would, but she won't so I don't.
  • Thanked: 75
  • Experience: Beginner
  • OS: Windows XP
Re: Qbasic and the CTRL+C command
« Reply #3 on: July 17, 2007, 04:58:50 AM »
Documentation:



Another question for you experts:
How could I make a key combination activate a sub or GOTO command, for example:
If I wanted CTRL+H to give the command
Code: [Select]
goto help    or   
Code: [Select]
call helphow would I go about doing that?

Am not sure what the Documentation part of your response is all about but I might just get round to trying it one fine day.

You didn't say what version of QBasic you are using but key combinations generally only allow for Gosub execution.  You could call a sub from within the Gosub routine.  Here is an example of CTRL+H but note this executes only when Capslock, Numlock and Shift are Off..

Code: [Select]
CLS
KEY 18, CHR$(&H4) + CHR$(&H23)   ' user defined key within range 15 - 25
KEY(18) ON: ON KEY(18) GOSUB 40

do                               ' simplest of loops to keep prog running
loop                            ' until the Ctrl+h combination is pressed


40 SHELL "type c:\windows\system32\eula.txt"    ' test
END
RETURN

CHR$(&H4) is the Keyboard Flag for CTRL and CHR$(&H23) is the Scancode for the letter H.

The example has been tested using QB ver 4.5, no warranties given.

Good luck




« Last Edit: July 17, 2007, 04:09:12 PM by Dusty »
One good deed is worth more than a year of good intentions.

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: Qbasic and the CTRL+C command
« Reply #4 on: July 17, 2007, 06:32:27 PM »
Okay, thanks, Dusty

I have the newest version of Qbasic (1988... really new...)
So all should work well