Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Nov 2002
    Location
    Port Talbot, Wales
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re-Writing VB Code at RunTime (VB 6)

    One of the guys in work says he has heard that you can get VB to re-code itself during runtime. Is this true and how the heck do you do it?

    Thanks
    Jambo

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Re-Writing VB Code at RunTime (VB 6)

    Does he explain what he means by "recode itself"?
    Charlotte

  3. #3
    Star Lounger
    Join Date
    Nov 2002
    Location
    Port Talbot, Wales
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Re-Writing VB Code at RunTime (VB 6)

    I think he measn that the you can write code to change other parts of the code during run time. Kinda like adding a textbox to a form durig run time but changeing the code itself.

    I think!

    Jambo

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Re-Writing VB Code at RunTime (VB 6)

    I'm going to stick out my neck by saying that although it might be possible in theory, it is not feasible in reality. The VB compiler turns source code into machine code (or into p-code, a kind of intermediary code); there is so much going on at that level that it is not realistic to try and modify it.

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Re-Writing VB Code at RunTime (VB 6)

    Hi Hans,

    Not only would one have the problem of trying to target the particular piece of machine code (the location of which can vary every time the source code is recompiled), but I think would would probably then run foul of the OS's meory protection, since the code should rside in a prtected portion of the memory.

    Self-modifying code used to readily achieved under DOS, which had no memory protection, and I wrote one or two assembly langiage utilities that did that. I wouldn't even have tried with VB's predecessor - QB.

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

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