dcsimg
Results 1 to 9 of 9

Thread: Captcha in Vb6

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Location
    Bangalore India
    Posts
    201

    Arrow Captcha in Vb6

    Hi!
    i have 1 requirement in vb6.
    i need to generate captcha randomly in vb6.
    how to do this in vb6.
    pls help me its very urgent.

    with regards!
    Sethuraman R

  2. #2

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Location
    Bangalore India
    Posts
    201

    Arrow Re: Captcha in Vb6

    Hi!
    Yes i want it in a similar fashion but it should ne generated randomly.

  4. #4

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,126

    Re: Captcha in Vb6

    Code:
    Private Sub Command1_Click()
    'Generate a string between 4 and 7 characters long, inclusive
    MsgBox GenerateRandomText(4, 7)
    End Sub
    
    Private Sub Form_Load()
    Randomize
    End Sub
    Public Function GenerateRandomText(intMin As Integer, intMax As Integer) As String
    
        Dim intLen As Integer
        Dim lngNdx As Long
        'Valid characters
        Const CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
        
        'Determine length of output
        intLen = Int((intMax - intMin + 1) * Rnd + intMin)
        
        'Generate the output
        For lngNdx = 1 To intLen
            GenerateRandomText = GenerateRandomText & Mid$(CHARACTERS, Int((Len(CHARACTERS)) * Rnd), 1)
        Next
    End Function

  6. #6
    Frenzied Member Jim Davis's Avatar
    Join Date
    Mar 2001
    Location
    Mars base one Username: Jim Davis Password: yCrm33
    Posts
    1,284

    Re: Captcha in Vb6

    Marty, it's compact and smart! Nice! I would include numbers too.

    Code:
        
    Const CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    One more thought. Isn't Randomize Timer gives better better randomizations? I also use Rnd(Timer) in conjunction with randomize timer. Gives it any difference, compared to the results without the Timer?

    edit: nevermind, i read about it. seems like both have the same effect, randomize timer / rnd(timer).
    Last edited by Jim Davis; Oct 26th, 2009 at 02:46 PM.

  7. #7

  8. #8
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,646

    Re: Captcha in Vb6

    Is there any way to output them in messy look... (just like in webpages)...???

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Feb 2009
    Location
    Bangalore India
    Posts
    201

    Arrow Re: Captcha in Vb6

    Hi!
    Thanks a lot it works fine.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width