Home > Software engineering >  VB6 realize FTP download large files genuflect is begged BuKa code
VB6 realize FTP download large files genuflect is begged BuKa code

Time:11-12

VB6 realize FTP download, I already have a code, is done by FTPGETFILE, download a small file can also normal, download a large file, get stuck, I find have a code on the Internet, said at the time of connect FTP, modify the seventh parameter dwFlags INTERNET_FLAG_PASSIVE namely active mode can, but I tried, still won't do, I want to ask in what ways, if any, can also realize BuKa meal?

Thank you!!!!!!

CodePudding user response:

INTERNET_FLAG_PASSIVE VB6 programming card he has nothing to do with you
Program caton because FTPGETFILE API need time to finish, I only know a few practice
1. Do not use FTPGETFILE, convert INet control but INet control some set can't change, can not reach your demand
2. Use the Multi - Threading, but this is not easy, and be careful handling, refer to http://www.freevbcode.com/ShowCode.asp? ID=1287
3. To find a find someone else to write good control item, remember to have seen can deal with this problem before

CodePudding user response:

reference 1st floor ypk9999 response:
INTERNET_FLAG_PASSIVE VB6 programming card he has nothing to do with you
Program caton because FTPGETFILE API need time to finish, I only know a few practice
1. Do not use FTPGETFILE, convert INet control but INet control some set can't change, can not reach your demand
2. Use the Multi - Threading, but this is not easy, and be careful handling, refer to http://www.freevbcode.com/ShowCode.asp? ID=1287
3. Find a find someone else to write good control item, remember that there used to be seen can deal with the problem of


That is as long as you use FTPGETFILE, will card right?

CodePudding user response:

refer to the second floor penguinhzf response:
Quote: refer to 1st floor ypk9999 response:

INTERNET_FLAG_PASSIVE VB6 programming card he has nothing to do with you
Program caton because FTPGETFILE API need time to finish, I only know a few practice
1. Do not use FTPGETFILE, convert INet control but INet control some set can't change, can not reach your demand
2. Use the Multi - Threading, but this is not easy, and be careful handling, refer to http://www.freevbcode.com/ShowCode.asp? ID=1287
3. Find a find someone else to write good control item, remember that there used to be seen can deal with the problem of


That is as long as you use FTPGETFILE, will card right?


In the method of 2, or use FTPGetFile actually, just in addition to create a thread execution, so the original program can continue to perform other work, of course, need to download the file to continue the work, or to another thread FTPGetFile complete to continue

CodePudding user response:

Add this code to load or handle events:

DoEvents

The cost of 1, Doevents is slow, but response to program and have, in fact Doevents statement allows any application to perform related events, not just your own program, so more slowly, can let its response to the event action program, need to use the API function GetInputState

For example: If GetInputState () Then DoEvents' instead of DoEvents can make the loop run faster,

2, be careful to make sure to DoEvents give up control process, before the first DoEvents returns, can't again by other parts of the code calls; Otherwise it will produce unexpected results, in addition, if the other application may in unpredictable ways and the process interactions, so don't use DoEvents, because now can't give up control,

CodePudding user response:

reference 5 floor qq_37571203 reply:
add this code to load or handle events:

DoEvents

The cost of 1, Doevents is slow, but response to program and have, in fact Doevents statement allows any application to perform related events, not just your own program, so more slowly, can let its response to the event action program, need to use the API function GetInputState

For example: If GetInputState () Then DoEvents' instead of DoEvents can make the loop run faster,

2, be careful to make sure to DoEvents give up control process, before the first DoEvents returns, can't again by other parts of the code calls; Otherwise it will produce unexpected results, in addition, if the other application may in unpredictable ways and the process interactions, so don't use DoEvents, because can't give up control,


Has DOEVENTS my code, but no effect, because it's in executing that code card, according to my understanding, DOEVENTS is used inside the loop, you can not die cycle, do you have by FTPGETFILE BuKa examples?

CodePudding user response:

reference 4 floor ypk9999 response:
Quote: refer to the second floor penguinhzf response:

Quote: refer to 1st floor ypk9999 response:

INTERNET_FLAG_PASSIVE VB6 programming card he has nothing to do with you
Program caton because FTPGETFILE API need time to finish, I only know a few practice
1. Do not use FTPGETFILE, convert INet control but INet control some set can't change, can not reach your demand
2. Use the Multi - Threading, but this is not easy, and be careful handling, refer to http://www.freevbcode.com/ShowCode.asp? ID=1287
3. Find a find someone else to write good control item, remember that there used to be seen can deal with the problem of


That is as long as you use FTPGETFILE, will card right?


In the method of 2, or use FTPGetFile actually, just in addition to create a thread execution, so the original program can continue to perform other work, of course, need to download the file to continue the work, or to another thread FTPGetFile completed to continue


If this is similar to multiple processes or multithreaded processing?
Because the example has no way to download, see the inside of the code should not completely, can only guess that it should be similar to multiple threads or processes,

CodePudding user response:

Use the Microsoft Internet Transfer Control controls a try?

CodePudding user response:

refer to the eighth floor milaoshu1020 response:
using the Microsoft Internet Transfer Control controls a try?


This I've tried, but often can appear the error such as "memory to READ", don't know whether I'm code problem or something, anyway not stable,

CodePudding user response:

Try this:
 
Private Sub Exec (ByVal CMD As String)
Rc.inet1. Execute, CMD
While rc.inet1. StillExecuting
DoEvents
Sleep 50
Wend
End Sub

CodePudding user response:

DoEvents is typically used in a long loop, each cycle, can hand over control to system
But this API call win32 API, before we had finished the work, will not be returned to the control, so when using ftogetfile API to download large files, in front of the file download is complete, there will be caton phenomenon

Inet I also use bad, so didn't use the

Possible approach is to use multithreading to avoid caton phenomenon

CodePudding user response:

11 references ypk9999 response:
DoEvents usually use in a long loop, each cycle, can hand over control to system
But this API call win32 API, before we had finished the work, will not be returned to the control, so when using ftogetfile API to download large files, in front of the file download is complete, there will be caton phenomenon

Inet I also use bad, so didn't use the

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • API
  • Related