Solved

Visual Basic Command Protocol

Posted on 2004-08-25
11
151 Views
Last Modified: 2013-11-25
Hello, I am currently writing an improved, aesthetically and practically, clone of MS-DOS. You might have seen another post about the same subject by Kgenis, as we are both working on it together, only difference is I only started learning VB last night... well here goes.

We currently have a few commands scripted that use two arguements, such as "Rm Driveletter\Path.to.file" then VB checks executes the DelTree command followed by the specified file. But now we need to make another set of commands that use just one arguement, such as a 'HELP' command that prints all the commands and there uses or a 'logoff' command, that logs the current user off the computer.

In summary:
The user types a command, e.g. 'help' into the texbox.
VB then takes this command and executes what we want it to do, in this case, using AddLine to print all of the commands and there uses to the screen.

Matt is not currently around so I can't contact him on the issue, and I would like it done by tomorrw, so any help is greatly appreciated. I appologise for the small amount of available points to hand out.

Regards, Ross
0
Comment
Question by:SirRoss
  • 6
  • 5
11 Comments
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11898586
Hope this helps:


Option Compare Text 'add this line to the top

Sub Command1_Click()
   Dim strTmp As String, arrStr() As String
   strTmp = Text1.Text
   arrStr = Split(strTmp, " ")
   Select Case arrStr(0)
      Case "help"
         PrintHelpToScreen
      Case "logoff"
         CallCodeToLogoffUser
      Case "rm"
         RemoveFolder arrStr(1)
   End Selecr
End Sub
0
 
LVL 1

Author Comment

by:SirRoss
ID: 11898751
Hmm... here is an image of how we have created this, it might help on the replies.

www.empirical-island.co.uk/images/os_prompt.gif

Here is a link to some of the current source:

http://rafb.net/paste/results/qTMrJ880.html

All help is much appreciated, thank you.
0
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11898833
Well it should work if you comment (add ' before it) this line:

If Len(tmpArgument) = 0 Then GoTo Err

Darko
0
 
LVL 1

Author Comment

by:SirRoss
ID: 11898884
No that doesn't work...

It also needs that in for it too work, there needs to be a second function or something that checks to see if help or other single arguement commands are typed and deals with them appropriately.
0
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11901531
Okay, try this then:


Sub Command1_Click()
   Dim strTmp As String, arrStr() As String
   strTmp = Text1.Text
   arrStr = Split(strTmp, " ")
   Select Case Ubound(arrStr)
      Case 0
         'nothing
      Case 1
         '1 argument
      Case Else
        'more arguments
   End Select
End Sub
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Author Comment

by:SirRoss
ID: 11907215
Hmm.... I'm afraid that won't work either, we are still looking for answers, but our anti-crack devices and such activated when i installed some new hardware that changed my internal info, so I corrupted the data. We have backups but we have to remake the forms.
0
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11907918
Well ALL three solutions work (if you know where to put them), so please be more specific...

Darko
0
 
LVL 1

Author Comment

by:SirRoss
ID: 11908782
From the source code displayed at this link:

http://rafb.net/paste/results/qTMrJ880.html

Can you please inform me of where to put them, either by posting it here, or using:

http://rafb.net/paste/

To upload it.

Many thanks in advance.
 - Ross
0
 
LVL 22

Accepted Solution

by:
DarkoLord earned 200 total points
ID: 11911025
0
 
LVL 1

Author Comment

by:SirRoss
ID: 11911544
Thanks You. :) Its really helpfull. I'm glad I finally got it done.
0
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11915297
You're welcome

Darko
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now