Results 1 to 21 of 21

Thread: Autosaving a project in VB6

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Autosaving a project in VB6

    I know it's a lot to ask, but is there any way (even with another program, which might be preferable) to make VB6 IDE save the project every X minutes? If this isn't possible, instead is there any way of "accessing" the project's data in memory with another program so that it can be backed up by that program without affecting the user's flow (so they don't even notice it happening, they just know it is going to happen regularly and keep their code safe)?

    I think sendmessage might be too intrusive if the user is actively writing a program and if they're running their program (granted it doesn't need saving) the sendmessage might cause unexpected results.

    This is part of a larger project I am considering working on, and if it all seems doable there'll be a few more questions coming from me in the near future as I work on it, and the eventual end design will be free for anyone to use and MAYBE open source if people don't give any good reasons for why it shouldn't be...I'm happy with it being open-source myself :-)
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  2. #2
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Autosaving a project in VB6

    smUX

    Here's an off-the wall idea for you...

    Have another app running in the background.
    --It would sound a bell at the X minute interval to alert the programmer.
    --It would then use CursorPos to move the mouse to the Save button on the IDE, and click it.

    There are probably several issues here, and might not even work (I haven't tried it).
    But, worth a shot?

    Alt #1: Just have a modal MsgBox pop-up with the message--

    Time to save, you knuckle-head.

    Spoo
    Last edited by Spoo; Mar 26th, 2010 at 03:16 PM. Reason: add Alt #1

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Autosaving a project in VB6

    I'm looking more for something that doesn't distract the programmer from his/her task rather than something that reminds them to save or interferes with their coding, although if I can't find a workable solution I'll probably have to stick with a reminder instead. I'm sure there's a way to access the memory and extract the data directly, just it's too much of a mammoth task for me to even think about trying :-)

    Also, I am planning to set up this external program to save incremental changes so if you made a mistake in coding you could easily go back to an old version if required, or if it saved at the worst possible time you'd have an old backup to go back to.
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  4. #4
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Autosaving a project in VB6

    smUX

    OK.. it was a rather blunt instrument of an idea.

    What about this..

    Have your "external" app simply read all of the files in the project.
    I've done this with .FRM files - they're really just text files. I imagine
    that all other types (.BAS, .FRX, .VBP, .VBW, etc) are likewise just
    text files.

    Then it could create a parallel set of files (with appropriate extensions),
    perhaps in a separate subdirectory.

    To carry this out to an extreme, and to facilitate your "go back to older version"
    idea, just create multiple subdirectories, one for each version being saved.

    Spoo

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Autosaving a project in VB6

    Have your "external" app simply read all of the files in the project.
    I've done this with .FRM files - they're really just text files. I imagine
    that all other types (.BAS, .FRX, .VBP, .VBW, etc) are likewise just
    text files.
    until you save the project files the above are not updated

    there is built in provision, to autosave on running the project which will prevent losses on crashing the ide
    menu > tools > options > enviroment > save changes

    i believe it would be possible to do a timed save using a VB6 addin
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Autosaving a project in VB6

    I was considering backing up the saved data files, although that still requires the user to be a regular file saver. I was also thinking about watching each file's last access time and only backing up if the times had changed.

    Also, I would probably work on a differential incremental backup, so only the changes to the data is saved each time rather than having to save the whole thing each time and waste space...in theory that could amount to months and months of backups only taking up maybe double the space of the actual original file

    Hopefully someone else has an idea of a way to "force" VB6 to save the program without user intervention or a way to access the data in memory, as that'll probably be the most efficient way to do it.

    Quote Originally Posted by westconn1 View Post
    there is built in provision, to autosave on running the project which will prevent losses on crashing the ide
    menu > tools > options > enviroment > save changes
    That might be useful to point out to people, it'd ensure a little bit of extra security
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  7. #7
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Autosaving a project in VB6

    I'm not sure how good an idea the autosave would be. You can do a lot of work before you save, and some of it could be bad and damage the old/good code. If at any point you wanted to revert to the original you could close (without save) and reopen the project. Without save this won't be possible.

  8. #8
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Autosaving a project in VB6

    Quote Originally Posted by westconn1 View Post
    until you save the project files the above are not updated
    Picky, picky...
    Of course, you are correct.

    Spoo

  9. #9

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Autosaving a project in VB6

    Quote Originally Posted by baja_yu View Post
    I'm not sure how good an idea the autosave would be. You can do a lot of work before you save, and some of it could be bad and damage the old/good code. If at any point you wanted to revert to the original you could close (without save) and reopen the project. Without save this won't be possible.
    Except what I am trying to accomplish is an *incremental* backup system where every time the files are backed up a copy of the PREVIOUS save is safely stored and only the changes are stored...if you ever want to go back to a previous version it'll be there readily available for you :P
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  10. #10
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Autosaving a project in VB6

    Quote Originally Posted by baja_yu View Post
    I'm not sure how good an idea the autosave would be. You can do a lot of work before you save, and some of it could be bad and damage the old/good code. If at any point you wanted to revert to the original you could close (without save) and reopen the project. Without save this won't be possible.
    I had a similar idea floating around in my mind..

    What if the save occurs at "mid-sentence" when writing
    a line of code. It would never be compilable.

    There must be a reason why MS only gave the options that WC
    referenced above, and left out an AutoSave on a timed basis.

    Spoo

  11. #11

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Autosaving a project in VB6

    It may not be compilable but at least it'll contain the bits of info you need to make it compilable. Also, in theory you could complete a partial line by looking at the differences in each line between two backups and calculating what the full line should be based on the differences...and you could just as easily save code manually that isn't compilable anyway, coders usually know what needs to be done to their own projects to fix the problem
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  12. #12
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Autosaving a project in VB6

    Quote Originally Posted by smUX View Post
    Except what I am trying to accomplish is an *incremental* backup system where every time the files are backed up a copy of the PREVIOUS save is safely stored and only the changes are stored...if you ever want to go back to a previous version it'll be there readily available for you :P
    What you are referring to is called revision control. It's what the now defunct SourceSafe was meant for, and what MS Team Foundation Server is used. Others include CVS and the popular Subversion.

    Take a look here: http://en.wikipedia.org/wiki/Compari...ntrol_software

  13. #13
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Autosaving a project in VB6

    smUX

    Given the foregoing, I would guess that your principal
    remaining option is the alternative you proposed in your
    OP, that is, to access memory, as this is where changes
    would reside prior to physically saving changes.

    Sadly, that is way above my pay grade.
    I imagine that it is doable, though.

    Spoo

  14. #14

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Autosaving a project in VB6

    Quote Originally Posted by baja_yu View Post
    What you are referring to is called revision control. It's what the now defunct SourceSafe was meant for, and what MS Team Foundation Server is used. Others include CVS and the popular Subversion.
    They look like the sort of thing I intended to work on, pretty much, but I like to do these things myself even if it never actually gets used...I like the practice and a challenge, and it's the way I learn new tricks...plus it'll do exactly what I want it to do

    Quote Originally Posted by Spoo View Post
    Given the foregoing, I would guess that your principal
    remaining option is the alternative you proposed in your
    OP, that is, to access memory, as this is where changes
    would reside prior to physically saving changes.

    Sadly, that is way above my pay grade.
    I imagine that it is doable, though.
    Above mine too, sadly...I have a basic idea of peeking memory and the basic idea of what needs to be done, just not how to do it exactly or how to find the required pointers to the section of memory to peek if I even knew how to do it in VB6...I used to be able to do it in old BASIC systems, which is how I know the basics of it
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  15. #15
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Autosaving a project in VB6

    There are a lot of them that are open source, but I doubt any were written in VB. Mostly C++. If you know it, you can peek at their code and see how they do stuff.

  16. #16
    Lively Member C0der's Avatar
    Join Date
    Mar 2010
    Location
    Somewhere in Internet
    Posts
    113

    Re: Autosaving a project in VB6

    Try:
    Auto File Save Add-in for Visual Studio 6.0
    it save your project every 5, 10, 15 minutes, etc.

  17. #17
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Autosaving a project in VB6

    Quote Originally Posted by smUX View Post
    but I like to do these things myself even if it never actually gets used...I like the practice and a challenge, and it's the way I learn new tricks...plus it'll do exactly what I want it to do
    My kind of guy!


    Quote Originally Posted by smUX View Post
    Above mine too, sadly...I have a basic idea of peeking memory and the basic idea of what needs to be done, just not how to do it exactly or how to find the required pointers to the section of memory to peek if I even knew how to do it in VB6...I used to be able to do it in old BASIC systems, which is how I know the basics of it
    All right -- game on.

    I'm knee deep in another project, but am willing to join the fray.
    Hope that'll be ok -- my off-and-on attendance, that is.

    Spoo

  18. #18

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Autosaving a project in VB6

    Quote Originally Posted by C0der View Post
    Try:
    Auto File Save Add-in for Visual Studio 6.0
    it save your project every 5, 10, 15 minutes, etc.
    That coupled with the incremental backup might be a good solution

    Quote Originally Posted by Spoo View Post
    All right -- game on.

    I'm knee deep in another project, but am willing to join the fray.
    Hope that'll be ok -- my off-and-on attendance, that is.
    I tend to do coding projects on my own, my coding styles and sloppy methods don't always work well for other people, but if the code is open source (which it probably will be) then people can do what they want with it
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  19. #19
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Autosaving a project in VB6

    smUX

    I wonder if this post might be a place to start.

    In particular, MEMORY_BASIC_INFORMATION -- I just did a search on that.

    Spoo

  20. #20
    Lively Member C0der's Avatar
    Join Date
    Mar 2010
    Location
    Somewhere in Internet
    Posts
    113

    Re: Autosaving a project in VB6

    Ok, if you think you can use it, here you have it.
    Attached Files Attached Files

  21. #21

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: Autosaving a project in VB6

    Quote Originally Posted by Spoo View Post
    I wonder if this post might be a place to start.

    In particular, MEMORY_BASIC_INFORMATION -- I just did a search on that.
    Looks like it could be useful...if I decide to work on it I'll try to make use of it. I'm thinking about making it so the person prefixes their code with 'startbackup and suffixes it with 'endbackup so it has something to search for...I'll work all that out when the time comes though
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

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