Results 1 to 12 of 12

Thread: How would you make 1 letter appear at a time W/O having 50 timers? Thanks- HELP!

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Heaven........ Whats that fire doing here?
    Posts
    39

    Question How would you make 1 letter appear at a time W/O having 50 timers? Thanks- HELP!

    I would like the words GOOD - BYE to appear 1 at a time.... im kinda making a fake virus for my friend... he wants to load it onto one of his friends pc's to really freak him out.... it has a timer and you can set the time to whatever you want.. the form is hidden and at the time you set.... a screen comes up with a worm... changing colors... saying above it VIRUS WORM 51268 ..... then it shuts down your compurter....... Kinda dumb but I would love any help you could give me on the letters GOOD - BYE appearing 1 at a time, about a half second apart...


    -THANKS IN ADVANCED!!!!!

  2. #2
    Lively Member jamieoboth's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    116
    Well.... You could have the text box, and then put a blank label on top. Then, using ONE timer, move the left of the blank label across, so it shows a bit of the message at one time.
    Put the following in the timer part

    EG:
    Code:
    ' This part says that if the blank label left is below the Form1 left * width then continue moving it, else, stop moving it to save system rersources)
    If blnklbl1.left > (form1.left * form1.width) then
    blnklbl1.left = blnklbl1.left - 100
    else:
    timer1.enabled = false
    Hope that helps!

    If not, tell me and I will try a different way!!
    Ich widerstehe allem - nur nicht der Versuchung

    (I can resist anything but temptation)

  3. #3
    Behemoth
    Guest
    Plenderj and Arbiter argued about this in a thread recently. you should be able to find it if you do a search.

    (incidentally they had almost identical code, and I think it was very similar to jamieoboth's)

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Or use the Sleep API to pause between the characters, and each time simply draw one more. (That's a C style approach, since it doesn't have such controls as in VB)
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Yeah, I would use Cornedbee's approach if you're not going to have anything else going at the same time.

    If you really want to freak him out, try opening, writing a letter to a text file that you make, and closing the file. Do this on a loop basis so the harddrive indicator is going mad.

    Something like this I would use:
    VB Code:
    1. Function ShowLetters(Delay As Long, Word As String, Output As Label)
    2. Dim I As Long
    3. Dim T As Long
    4.     Output.Caption = ""
    5.     For I = 1 To Len(Word)
    6.         T = GetTickCount
    7.         Do
    8.             DoEvents
    9.         Loop Until GetTickCount - T => Delay
    10.         Output.Caption = Output.Caption & Mid(Word, I, 1)
    11.     Next I
    12. End Function
    Use Delay as a millisecond value and make sure you have the GetTickCount API declared.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  6. #6

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Heaven........ Whats that fire doing here?
    Posts
    39

    Talking THANKS!!!!!!!!

    Ok, Sastraxi, You always answer my forums with good answers, but your too advanced for me.... I tried the Bees thing and yours but I didn't get anything to work,,,,, how would i pause between each letter? I just used the label thing, that is a lot easier.... and also where would be a good place to learn Direct-X, I am a beginner at it..... VERY VERY BEGINNER.....

    THANKS SO MUCH!!!!

  7. #7
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181

    Talking

    watch out with those programs!
    I once did one in a Basic like language called "asic" it was compilable and pretty fast it only had about 30 commands, and it only ran under dos...
    Well what I did was some kind of program looking kinda like scandisk. What it did to have the HD light go on and off, was to create and delete a folder... . It ran fast and without problems on my Pentium 75 (yeah it's long ago) but on my friends pc it was slow like hell. I told him that it would do diagonsis since his pc was pretty wrecked. When I saw how slow it ran I told him to turn it off, but he did not want to
    well after it was done it told him something like: Dude what did you do with this computer everything is screwed up and bla bla.
    well he didn't even get the joke since I wrote the message in English (I am german and so is he) and we were only about 14...
    well the program left some folder on the HD... as he deleted that folder it deleted the whole HD I really got no clue what happened, but that's what happend.
    (now I am pretty sure that the Motherboard was broken and was responsible for all of that...)

    well long story....
    all it says watch out! :
    Sanity is a full time job

    Puh das war harter Stoff!

  8. #8
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Okay, download this sample and see how to use it (it's a form):
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  9. #9
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    And here's one with the subclassing:
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  10. #10
    Addicted Member
    Join Date
    Jan 2001
    Location
    Little Rock, Ar
    Posts
    151
    VB Code:
    1. '1 textbox
    2. '1 label
    3. '1 Timer
    4. '1 CommandButton
    5. Private Sub Command1_Click()
    6.     Timer1.Interval = 100
    7.     Timer1.Enabled = True
    8. End Sub
    9.  
    10. Private Sub Form_Load()
    11.     Timer1.Enabled = False
    12. End Sub
    13.  
    14. Private Sub Timer1_Timer()
    15.     On Error GoTo Timer1_ERR
    16.     Static Counter As Integer
    17.     If Counter = Len(Text1.Text) + 1 Then
    18.         Counter = 0
    19.         'Label1.Caption = ""
    20.         Timer1.Enabled = False
    21.         Exit Sub
    22.     End If
    23.    
    24.     Label1.Caption = Left(Text1.Text, Counter)
    25.     Counter = Counter + 1
    26.    
    27.     DoEvents
    28.     Exit Sub
    29. Timer1_ERR:
    30.     Debug.Print Err.Number & ":" & Err.Description
    31.     Counter = 0
    32.     Timer1.Enabled = False
    33. End Sub

  11. #11
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Originally posted by Behemoth
    Plenderj and Arbiter argued about this in a thread recently. you should be able to find it if you do a search.

    (incidentally they had almost identical code, and I think it was very similar to jamieoboth's)
    That discussion was a looong time ago I believe
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  12. #12
    Hyperactive Member
    Join Date
    Feb 2002
    Posts
    261

    Re: How would you make 1 letter appear at a time W/O having 50 timers? Thanks- HELP!

    Originally posted by spyplayer
    I would like the words GOOD - BYE to appear 1 at a time.... im kinda making a fake virus for my friend... he wants to load it onto one of his friends pc's to really freak him out.... it has a timer and you can set the time to whatever you want.. the form is hidden and at the time you set.... a screen comes up with a worm... changing colors... saying above it VIRUS WORM 51268 ..... then it shuts down your compurter....... Kinda dumb but I would love any help you could give me on the letters GOOD - BYE appearing 1 at a time, about a half second apart...


    -THANKS IN ADVANCED!!!!!
    Ahh, If you really want to freak him out, you can make the CD-Rom door open and close by itself a couple of times!

    Put this in the declarations section:

    Private Declare Function mciSendString Lib "winmm.dll" Alias _
    "mciSendStringA" (ByVal lpstrCommand As String, ByVal _
    lpstrReturnString As String, ByVal uReturnLength As Long, _
    ByVal hwndCallback As Long) As Long


    To open the CD-Rom door, use this code (returnstring doesn't have to be set to anything):


    retvalue = mciSendString("set CDAudio door open", returnstring, 127, 0)


    To close to CD-Rom door, use this code:


    retvalue = mciSendString("set CDAudio door closed", returnstring, 127, 0)


    Sorry if this is off topic, but I think this would be pretty funny!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width