Solved

Visual Basic Command Protocol

Posted on 2004-08-25
11
152 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SAPE.heur.AE935 Visual Studio 3 38
How does CurrentUser work? 10 31
SLMGR Switches Are Not Working On KMS Host 3 69
Problem to With line 4 43
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

896 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

14 Experts available now in Live!

Get 1:1 Help Now