![]() |
|
|
Welcome to the { mindfrost82.com } forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Process in the background.
Hi
My VB aplication copies a lot of images from a removable media which is the first process (function). Is there a way to allow the copy process to run in the background, in order to let the application continue with other activities. ? (sending SQLquerries etc.) Right now I must wait untill all the files have been found and copied to my HD. A little pity. The copy process goes like this : Function CopyFile(InpFile As String, OutpFile As String) On Error Resume Next Dim ase As String Open InpFile For Binary As #1 ase = String(LOF(1), vbNullChar) Get #1, , ase Close #1 Open OutpFile For Binary Access Write As #2 Put #2, , ase Close #2 End Function |
|
|||
|
Re: Process in the background.
"Per Juul Larsen" <juul@larsen.dk> wrote in message news:27914$488cc86a$57486c0a$31719@news.comxnet.dk ... > Hi > > My VB aplication copies a lot of images from a removable media which is > the first process (function). > Is there a way to allow the copy process to run in the background, in > order to let the application continue with other activities. ? (sending > SQLquerries etc.) > > Right now I must wait untill all the files have been found and copied to > my HD. A little pity. > > The copy process goes like this : > > Function CopyFile(InpFile As String, OutpFile As String) > On Error Resume Next > Dim ase As String > Open InpFile For Binary As #1 > ase = String(LOF(1), vbNullChar) > Get #1, , ase > Close #1 > Open OutpFile For Binary Access Write As #2 > Put #2, , ase > Close #2 > End Function With your current design, no. However, have you considered copying the file through SHFileOperation? This way, the program continues while explorer takes over. |
|
|||
|
Re: Process in the background.
Raoul Watson skrev:
> "Per Juul Larsen" <juul@larsen.dk> wrote in message > news:27914$488cc86a$57486c0a$31719@news.comxnet.dk ... >> Hi >> >> My VB aplication copies a lot of images from a removable media which is >> the first process (function). >> Is there a way to allow the copy process to run in the background, in >> order to let the application continue with other activities. ? (sending >> SQLquerries etc.) >> >> Right now I must wait untill all the files have been found and copied to >> my HD. A little pity. >> >> The copy process goes like this : >> >> Function CopyFile(InpFile As String, OutpFile As String) >> On Error Resume Next >> Dim ase As String >> Open InpFile For Binary As #1 >> ase = String(LOF(1), vbNullChar) >> Get #1, , ase >> Close #1 >> Open OutpFile For Binary Access Write As #2 >> Put #2, , ase >> Close #2 >> End Function > > > With your current design, no. > > However, have you considered copying the file through > SHFileOperation? This way, the program continues while > explorer takes over. > > Thank you for your reply I will try to look at your proposed solution. kind regards pjl |
|
|||
|
Re: Process in the background.
Raoul Watson skrev:
> "Per Juul Larsen" <juul@larsen.dk> wrote in message > news:27914$488cc86a$57486c0a$31719@news.comxnet.dk ... >> Hi >> >> My VB aplication copies a lot of images from a removable media which is >> the first process (function). >> Is there a way to allow the copy process to run in the background, in >> order to let the application continue with other activities. ? (sending >> SQLquerries etc.) >> >> Right now I must wait untill all the files have been found and copied to >> my HD. A little pity. >> >> The copy process goes like this : >> >> Function CopyFile(InpFile As String, OutpFile As String) >> On Error Resume Next >> Dim ase As String >> Open InpFile For Binary As #1 >> ase = String(LOF(1), vbNullChar) >> Get #1, , ase >> Close #1 >> Open OutpFile For Binary Access Write As #2 >> Put #2, , ase >> Close #2 >> End Function > > > With your current design, no. > > However, have you considered copying the file through > SHFileOperation? This way, the program continues while > explorer takes over. > > Thank you for your reply I will try to look at your proposed solution. kind regards pjl |
|
|||
|
Re: Process in the background.
Per Juul Larsen wrote:
> Hi > > My VB aplication copies a lot of images from a removable media which is > the first process (function). > Is there a way to allow the copy process to run in the background, in > order to let the application continue with other activities. ? (sending > SQLquerries etc.) > > Right now I must wait untill all the files have been found and copied to > my HD. A little pity. > > The copy process goes like this : > > Function CopyFile(InpFile As String, OutpFile As String) > On Error Resume Next > Dim ase As String > Open InpFile For Binary As #1 > ase = String(LOF(1), vbNullChar) > Get #1, , ase > Close #1 > Open OutpFile For Binary Access Write As #2 > Put #2, , ase > Close #2 > End Function Another option is multithreading which is awkward but doable in VB6, or you can emulate it by starting another process to do the copying and some form of IPC (com, DDE, windows events, etc) to bnotify when it has finished. Whether you use this or SHFileOperation() depends how much control you want over the copying. -- Dean Earley (dean.earley@icode.co.uk) i-Catcher Development Team iCode Systems |
|
|||
|
Re: Process in the background.
Dean Earley skrev:
> Per Juul Larsen wrote: >> Hi >> >> My VB aplication copies a lot of images from a removable media which >> is the first process (function). >> Is there a way to allow the copy process to run in the background, in >> order to let the application continue with other activities. ? >> (sending SQLquerries etc.) >> >> Right now I must wait untill all the files have been found and copied >> to my HD. A little pity. >> >> The copy process goes like this : >> >> Function CopyFile(InpFile As String, OutpFile As String) >> On Error Resume Next >> Dim ase As String >> Open InpFile For Binary As #1 >> ase = String(LOF(1), vbNullChar) >> Get #1, , ase >> Close #1 >> Open OutpFile For Binary Access Write As #2 >> Put #2, , ase >> Close #2 >> End Function > > Another option is multithreading which is awkward but doable in VB6, or > you can emulate it by starting another process to do the copying and > some form of IPC (com, DDE, windows events, etc) to bnotify when it has > finished. > > Whether you use this or SHFileOperation() depends how much control you > want over the copying. > Thank you for the answer.I am considering what to do. Have tried Shell (batchfile) and it looks like it goes a little faster. mvh pjl |
|
|||
|
Re: Process in the background.
Per Juul Larsen wrote:
> Dean Earley skrev: >> Per Juul Larsen wrote: >>> Hi >>> >>> My VB aplication copies a lot of images from a removable media which >>> is the first process (function). >>> Is there a way to allow the copy process to run in the background, in >>> order to let the application continue with other activities. ? >>> (sending SQLquerries etc.) >>> >>> Right now I must wait untill all the files have been found and copied >>> to my HD. A little pity. >>> >>> The copy process goes like this : >>> >>> Function CopyFile(InpFile As String, OutpFile As String) >>> On Error Resume Next >>> Dim ase As String >>> Open InpFile For Binary As #1 >>> ase = String(LOF(1), vbNullChar) >>> Get #1, , ase >>> Close #1 >>> Open OutpFile For Binary Access Write As #2 >>> Put #2, , ase >>> Close #2 >>> End Function >> >> Another option is multithreading which is awkward but doable in VB6, >> or you can emulate it by starting another process to do the copying >> and some form of IPC (com, DDE, windows events, etc) to bnotify when >> it has finished. >> >> Whether you use this or SHFileOperation() depends how much control you >> want over the copying. >> > Thank you for the answer.I am considering what to do. > Have tried Shell (batchfile) and it looks like it goes a little faster. > > mvh pjl Erm, you will also find that the real CopyFile function is a lot faster, especially as the one you give doesn't do anything special. -- Dean Earley (dean.earley@icode.co.uk) i-Catcher Development Team iCode Systems |
|
|||
|
Re: Process in the background.
Dean Earley skrev:
> Per Juul Larsen wrote: >> Dean Earley skrev: >>> Per Juul Larsen wrote: >>>> Hi >>>> >>>> My VB aplication copies a lot of images from a removable media which >>>> is the first process (function). >>>> Is there a way to allow the copy process to run in the background, >>>> in order to let the application continue with other activities. ? >>>> (sending SQLquerries etc.) >>>> >>>> Right now I must wait untill all the files have been found and >>>> copied to my HD. A little pity. >>>> >>>> The copy process goes like this : >>>> >>>> Function CopyFile(InpFile As String, OutpFile As String) >>>> On Error Resume Next >>>> Dim ase As String >>>> Open InpFile For Binary As #1 >>>> ase = String(LOF(1), vbNullChar) >>>> Get #1, , ase >>>> Close #1 >>>> Open OutpFile For Binary Access Write As #2 >>>> Put #2, , ase >>>> Close #2 >>>> End Function >>> >>> Another option is multithreading which is awkward but doable in VB6, >>> or you can emulate it by starting another process to do the copying >>> and some form of IPC (com, DDE, windows events, etc) to bnotify when >>> it has finished. >>> >>> Whether you use this or SHFileOperation() depends how much control >>> you want over the copying. >>> >> Thank you for the answer.I am considering what to do. >> Have tried Shell (batchfile) and it looks like it goes a little faster. >> >> mvh pjl > > Erm, you will also find that the real CopyFile function is a lot faster, > especially as the one you give doesn't do anything special. > Hi. Tried Your advice.. Wrote this vbs Script : dim filesys Set filesys=CreateObject("Scripting.FileSystemObject") filesys.CopyFile"G:\DCIM\101MSDCF\*.jpg","c:\pictu re\backup\temp" and startet the vbs Script via SHELL in my VB. Result : 3 times faster !!! thank you. regars pjl |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|