How do I access the names of VB6 modules from code?

Posted by Mark Bertenshaw on Stack Overflow See other posts from Stack Overflow or by Mark Bertenshaw
Published on 2010-04-13T18:27:08Z Indexed on 2010/04/14 18:13 UTC
Read the original article Hit count: 182

Filed under:

Hi All -

It is unlikely that there is an answer for this one, but I'm asking anyway.

I am currently maintaining some code, which is likely to be refactored soon. Before that happens, I want to make the standard error handling code, which is injected by an Add-In, more efficient and take up less space. One thing that annoys me is that every module has a constant called m_ksModuleName that is used to construct a big string, which is then rethrown from the error handler so we can trace the error stack. This is all template code, i.e. repetivitve, but I could easily strip it down to a procedure call. Now, I have fixed the code so that you can pass the Me reference to the procedure - but you can't do that for the BAS modules. Nor can you access the project name (the part which would be passed as part of a ProgramID, for instance) - although you get given it when you raise an error yourself.

All these strings are contained in the EXE, DLL or OCX - believe me, I've used a debugger to find them. But how can I access these in code?

-- Mark Bertenshaw

© Stack Overflow or respective owner

Related posts about vb6