Login  
Search All Forums
Dart Home | PowerTCP Web for ActiveX | Custom Development Reply | PowerTCP Web for ActiveX Topics | Forums   
AuthorForum: PowerTCP Web for ActiveX
Topic: Second request returns success, but no data
User44

Posts: 3
Member Since: 05/09/02
posted June 8, 2002 3:55 PM

I have implemented the http control in a dll and am seeing issues on XP. Any help would be appreciated. Here is my code

In an application (EXE):

sub Form_Load()
 getFile
end sub

sub getFile()
 set webImage = createObject("myDll.myClass") 'dll containing control

 webImage.setUrl("http://some.web.site/image1.jpg")
 status = webImage.getImage("image1.jpg")
 text1.text = status
 
 webImage.setUrl("http://some.web.site/image2.jpg")
 status = webImage.getImage("image2.jpg")
 text2.text = status

end sub

Code inside of the dll:

Public Function getImage(imgName)
  
  Dim m_sContent As String
  Dim http1 As Object
  Dim newUrl As String
  Dim myFile

  dFile = FreeFile
If Dir$("c:\pic\" & imgName) = "" Then
        'do nothing, file is not found
    Else
        Kill "c:\pic\" & imgName
    End If
  
  Set http1 = CreateObject("Dart.Http.1")
   http1.Timeout = 30000
   newUrl = strUrl
   http1.Url = newUrl
   http1.Get m_sContent
  
  Do While Not http1.State = 0
    Loop
    
  myFile = FreeFile
    bFile = "c:\pic\" & imgName
    Open bFile For Output Lock Read Write As #myFile
    Print #myFile, m_sContent
    Close #myFile
  
  Set http1 = Nothing
  
  If CStr(Err.Number) = "0" Then
    returnStatus = "Success"
  Else
    'returnStatus = "Failed"
    GoTo onError
  End If
  getImage = returnStatus
  
  Exit Function
  
onError:
  returnStatus = "Failed: " & "Error #: " + CStr(Err.Number) + ": " + Err.Description
  getImage = returnStatus
  Exit Function


End Function


Under XP the first request works and the second one fails.
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted June 10, 2002 9:14 AM

Hi,
A couple of things:
First, you should not use CreateObject, or you will have licensing problems. Please see:
http://support.dart.com/KBDetail.dwp5
Second, eliminate the:
Do While Not http1.State = 0
loop. If the intent was to wait until the Get has completed, you have already accomplished this by setting the Timeout > 0.
Finally, the forum is not the venue for code review. If you would like us to help with your code, please contact support@dart.com for your options.
Thanks,
-ken
Reply | PowerTCP Web for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX