FtpGetGile with DoEvents
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: FtpGetGile with DoEvents

Hybrid View

  1. #1
    Join Date
    Nov 2001
    Location
    San Diego
    Posts
    102

    FtpGetGile with DoEvents

    I'm using FtpGetFile to retrieve a file on a remote server. Everything works except when the file is downloading, everything on the machine looks like it is frozen; however, it's just downloading the file. Is there a way to download the file in the background and the user can continue to do something else?

    When I try this, there is no improvement:

    Do While FtpGetFile(hConnection, gfile, strFName & gfile, false, 0, FTP_TRANSFER_TYPE_UNKNOWN, 0)
    DoEvents
    Loop




    Share on Google+

  2. #2
    Join Date
    Sep 2001
    Posts
    49

    Re: FtpGetGile with DoEvents

    I am not a guru in that area but if you put the code in a DLL and pass the information there. It is possible the DLL (being COM component) can run in the background.

    Just a thought.

    Share on Google+

  3. #3
    Join Date
    Aug 2013
    Posts
    2

    Re: FtpGetGile with DoEvents

    Hi my nic is centellajs, You most understand when you use a function api for example thi will use the default thread in the form, so you are waiting this reply to you with a handle,so looks like frozen because it depends about internet speed, the sfile size and other, you most undertand like programmer the need to use THREADS, so you can control the fuction , you can use another form so the process will depends on the another form, you cann use just call so the next functions will follow not rplydownloadfile= ftpget so it will wait it has finished how i tell you you can instance another form or function that can control ftpgetfile for example creating a thread :

    for example ftpget does the same than this

    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Declare Function CreateThread Lib "kernel32" (lpThreadAttributes As Any, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadID As Long) As Long
    Declare Function TerminateThread Lib "kernel32" (ByVal hThread As Long, ByVal dwExitCode As Long) As Long
    Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
    Public hThread As Long, hThreadID As Long

    Public Sub AsyncThread()
    'Let this thread sleep for 10 seconds
    Sleep 10000
    hThread = 0
    End Sub

    then when you call the function from the same procedure form or what ever it will freeze all,
    hThread = CreateThread(ByVal 0&, ByVal 0&, AddressOf AsyncThread, ByVal 0&, ByVal 0&, hThreadID)
    CloseHandle hThread, for example is the same case, so you can call ftpgetfile from another instance .


    So it depends about yours skills, don't wait it will exists an ftpgetfile(allparameters PLUS addressoff functioncontrol() ) so the function control would be called back even it is working, you most create this and to pay atention, ftpgetfile just is a function that loops chunks whilest done . anothet thinks is to use socks by clear, but you will find with the same THE THREADS are really important in proramming, you will find with this trouble with a native vb6 timer controls,in many programming language the threads doesn't exists and you most create Them

    God Bless You .

    Centellajs
    Share on Google+

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,074

    Re: FtpGetGile with DoEvents

    Hi Centellajs, thanks for your enthusiasm; but please remember this thread is 12 years old. By reviving old threads, the forum flow gets messed up.
    Share on Google+

  5. #5
    Join Date
    Aug 2013
    Posts
    2

    Re: FtpGetGile with DoEvents

    Quote Originally Posted by HanneSThEGreaT View Post
    Hi Centellajs, thanks for your enthusiasm; but please remember this thread is 12 years old. By reviving old threads, the forum flow gets messed up.
    That is the same i said to my chief boss i gave classes in intelligence system i don't consider a guru maybe yes or not maybe in areas just i know i love, and i fight and i fought in war information countries, many solved problems i checked out in internet for many posts and it doesn't exist, many of my solutions i don't post because could be read by iran country or others, but sometimes when i hear to speak the people ******* about solution honest i feel burning, other countries prefers xD to buy solutions to single companies like KL ND AVst firewalls and they consider me i am crazy jajaja Lol i prefer YES they think this, because if they know what i know,?? No no beter this (y) .

    Best Regards-
    Last edited by HanneSThEGreaT; August 27th, 2013 at 01:28 AM. Reason: Removed profanity
    Share on Google+

  6. #6
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,074

    Re: FtpGetGile with DoEvents

    I'm closing the thread now
    Share on Google+

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center