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.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Programming > Visual Basic

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-27-2008, 08:11 PM
Per Juul Larsen
 
Posts: n/a
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
Reply With Quote
  #2 (permalink)  
Old 07-27-2008, 08:30 PM
Raoul Watson
 
Posts: n/a
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.


Reply With Quote
  #3 (permalink)  
Old 07-27-2008, 10:25 PM
Per Juul Larsen
 
Posts: n/a
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
Reply With Quote
  #4 (permalink)  
Old 07-27-2008, 10:26 PM
Per Juul Larsen
 
Posts: n/a
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
Reply With Quote
  #5 (permalink)  
Old 07-28-2008, 09:45 AM
Dean Earley
 
Posts: n/a
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
Reply With Quote
  #6 (permalink)  
Old 07-28-2008, 05:34 PM
Per Juul Larsen
 
Posts: n/a
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
Reply With Quote
  #7 (permalink)  
Old 07-29-2008, 08:44 AM
Dean Earley
 
Posts: n/a
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
Reply With Quote
  #8 (permalink)  
Old 07-29-2008, 11:04 AM
Per Juul Larsen
 
Posts: n/a
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
Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Programming > Visual Basic


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:24 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Loans | Per Insurance | Loans | Mortgage Calculator | Free Advertising



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114