Can VBA code rewrite itself?

Discussion in 'AutoCAD' started by D Hartley, May 25, 2004.

  1. D Hartley

    D Hartley Guest

    This may be just a question based on pathetic ignorance, but I had a
    thought. If it's possible, while running, for code in a module to delete
    another section of code, then save the dvb project, you could build in a
    protection scheme for your application.
    The project would write an obscure file to the user's computer the first
    time it runs, change itself, and then every other time it runs would look
    for this file. If the file is not there the application would not start, and
    would thus protect against use on another machine.

    I know you could get around this in various ways, but my question really is,
    Is it possible for an application to change its own code and save itself?

    Thanks for your indulgence

    David
     
    D Hartley, May 25, 2004
    #1
  2. D Hartley

    Ed Jobe Guest

    Sure, you need to reference "Microsoft Visual Basic for Applications 5.3" if you are working in vba, or "Microsoft Visual Basic 6.0 Extensibility" for VB.

    --
    ----
    Ed
    ----
    This may be just a question based on pathetic ignorance, but I had a
    thought. If it's possible, while running, for code in a module to delete
    another section of code, then save the dvb project, you could build in a
    protection scheme for your application.
    The project would write an obscure file to the user's computer the first
    time it runs, change itself, and then every other time it runs would look
    for this file. If the file is not there the application would not start, and
    would thus protect against use on another machine.

    I know you could get around this in various ways, but my question really is,
    Is it possible for an application to change its own code and save itself?

    Thanks for your indulgence

    David
     
    Ed Jobe, May 25, 2004
    #2
  3. D Hartley

    D Hartley Guest

    Ed
    I found the somewhat garbled example in the VBE section of the VBA help file. That's a very interesting feature. Will this work for anyone's AutoCAD as long as they can run VBA of any sort?

    David


    --

    Sure, you need to reference "Microsoft Visual Basic for Applications 5.3" if you are working in vba, or "Microsoft Visual Basic 6.0 Extensibility" for VB.

    --
    ----
    Ed
    ----
    This may be just a question based on pathetic ignorance, but I had a
    thought. If it's possible, while running, for code in a module to delete
    another section of code, then save the dvb project, you could build in a
    protection scheme for your application.
    The project would write an obscure file to the user's computer the first
    time it runs, change itself, and then every other time it runs would look
    for this file. If the file is not there the application would not start, and
    would thus protect against use on another machine.

    I know you could get around this in various ways, but my question really is,
    Is it possible for an application to change its own code and save itself?

    Thanks for your indulgence

    David
     
    D Hartley, May 26, 2004
    #3
  4. D Hartley

    Ed Jobe Guest

    As long as vba is loaded.

    --
    ----
    Ed
    ----
    Ed
    I found the somewhat garbled example in the VBE section of the VBA help file. That's a very interesting feature. Will this work for anyone's AutoCAD as long as they can run VBA of any sort?

    David


    --

    Sure, you need to reference "Microsoft Visual Basic for Applications 5.3" if you are working in vba, or "Microsoft Visual Basic 6.0 Extensibility" for VB.

    --
    ----
    Ed
    ----
    This may be just a question based on pathetic ignorance, but I had a
    thought. If it's possible, while running, for code in a module to delete
    another section of code, then save the dvb project, you could build in a
    protection scheme for your application.
    The project would write an obscure file to the user's computer the first
    time it runs, change itself, and then every other time it runs would look
    for this file. If the file is not there the application would not start, and
    would thus protect against use on another machine.

    I know you could get around this in various ways, but my question really is,
    Is it possible for an application to change its own code and save itself?

    Thanks for your indulgence

    David
     
    Ed Jobe, May 26, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.