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
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » 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.
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
[Fmr MS MVP - Word]
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.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications