Results 1 to 11 of 11

Thread: Backing up and threading

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    137

    Backing up and threading

    Hi, I would like to back up my database my creating copies of it while my program is running.. I co worker suggested threading it in the background and use a timer to make a copy of the database ever hour or so.. He's not sure how to do this in VB since he's more of a VC++ guy.. I'm not really sure how to create threads in VB.. Can someone point me to some links? Also, anyone knows any system calls to create a copy of a file and rename to something else in the same directory?

    Also, can what I'm trying to do be hidden so the user doesn't know that a back up is being made?
    Thanks
    John

  2. #2
    Unfortunately, you can't do multithreading in VB outside the IDE. The closest thing you can do is use a timer with an Interval of 1.

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I disagree I have done 'multithreading' and background or asynchronous processing before. Do a search in the forums here on either of those subjects.

  4. #4
    You can multithread WITHIN the VB IDE in apartment-style threading. But outside the IDE (i.e., compiled EXEs), multithreading is a no-no.

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Like I said I disagree. Using ActiveX Exs you can at least accomplish the same thing, asynchronous processing. Its all the same to the user. Check out the Coffee example.

  6. #6
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    Edneeis is right. Createthread api fails with VB6, but active x exes are the way to successfully multithread in VB6.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    137
    Thanks.. I'll have to look into Active X Exes.. Will these work if I wanted to have a infinite loop checking for the time and if 1 hr have passed, copy the mdb into a backup directory? Would this have an adverse affect on the processor?
    Thanks
    John

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    137
    Hmm.. I just thought of something.. Several instances of my app will be opened at once (usually 2).. If I created this Active X exe, both instances will call it and back a back up, right? Is there a way to prevent that? Also, what is the ramifications of copying a database when data is being read or written while the copy is being made?
    Thanks
    John

  9. #9
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    If you mean their will be mulitple instances of your program running on the same computer then you could take it a step further and have all the instances use the same data/info. You could use DCOM to do this over a network as well but I haven't successfully done it over a network without installing the component on the clients.

  10. #10
    Addicted Member Gavin_Mannion's Avatar
    Join Date
    Aug 2001
    Location
    London, UK
    Posts
    214

    test

    testing
    Gavin Mannion

    Jackofalltrades.

    "Some people are alive simply because it is against the law to kill them." - Anonymous

    //TODO: Insert smart comment here

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    137
    Hi, I'm trying to put together an Active X EXE.. One thing, how do you refer to the path of where that Active X Exe is in? I tried app.path, but for some reason, it returns the path where the Active X exe was compiled to.. If I copy it to another directory, it returns the path that it was compiled to..
    Thanks in advance.
    John

Posting Permissions

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



Click Here to Expand Forum to Full Width