Results 1 to 7 of 7

Thread: Help making this faster [VB]

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    116

    Help making this faster [VB]

    is there anyway i can make this go faster. right now it is taking around 2.4 seconds and i'm trying to get it to at least 2 or so.

    VB Code:
    1. Private Function strCoordinates(ImageURL As String, Referer As String) As String
    2.     Dim img() As Byte
    3.     Dim Pet As StdPicture
    4.     Dim ct As Integer
    5.     Dim ctx As Long
    6.     Dim cty As Long
    7.     Dim x As Long
    8.     Dim y As Long
    9.     Dim Value As Single
    10.  
    11.     GetSource "GET", "captcha_show.phtml?" & ImageURL, "www.neopets.com", "http://www.neopets.com/haggle.phtml?" & Referer, strSession, ""
    12.  
    13.     img = StrConv(strSource, vbFromUnicode)
    14.     Set Pet = ToJpg(img)
    15.     Set picPet.Picture = Pet
    16.  
    17.     Value = 4900000
    18.     Do Until ct <> 0
    19.         For y = 0 To picPet.ScaleHeight - 1
    20.         For x = 0 To picPet.ScaleWidth - 1
    21.         If GetPixel(picPet.hdc, x, y) < Value Then
    22.             ct = ct + 1
    23.             ctx = ctx + x
    24.             cty = cty + y
    25.         End If
    26.         Next x
    27.         Next y
    28.         Value = Value + 500000
    29.         DoEvents
    30.     Loop
    31.  
    32.     strCoordinates = "&x=" & Int(ctx / ct) & "&y=" & Int(cty / ct)
    33.     Set Pet = Nothing
    34. End Function

    thanks for any help
    Last edited by cx323; Sep 17th, 2005 at 10:34 PM.

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