[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

VB Source Code Info Access In A VB6 App

BeeJ

12/22/2011 4:26:00 PM

Is there a way to access the same information that is accessible in an
Add-In (code)?

E.g. (a simple indirect example)
MZ-Tools gets this info.
(Yes, I know this is their scripting for their Add-In but shows the
type of info I would like to access.)

On Error GoTo {PROCEDURE_NAME}Err

{PROCEDURE_BODY}

{PROCEDURE_NAME}Exit:
Exit {PROCEDURE_TYPE}

{PROCEDURE_NAME}Err:
Debug.Print "{PROCEDURE_NAME} " & Err.Description
Resume {PROCEDURE_NAME}Exit

Currently I use MZ-Tools to create the error handler such as this
however they only allow one error handler and one procudure handler ...

I am hoping to write one "universal" sub that can work with passed
things like "{PROCEDURE_NAME}" etc.

Is that possible? Or do I have to ask MS to add that feature? lol


6 Answers

Dee Earley

12/22/2011 5:12:00 PM

0

On 22/12/2011 16:25, BeeJ wrote:
> Is there a way to access the same information that is accessible in an
> Add-In (code)?
>
> E.g. (a simple indirect example)
> MZ-Tools gets this info.
> (Yes, I know this is their scripting for their Add-In but shows the type
> of info I would like to access.)
>
> On Error GoTo {PROCEDURE_NAME}Err
>
> {PROCEDURE_BODY}
>
> {PROCEDURE_NAME}Exit:
> Exit {PROCEDURE_TYPE}
>
> {PROCEDURE_NAME}Err:
> Debug.Print "{PROCEDURE_NAME} " & Err.Description
> Resume {PROCEDURE_NAME}Exit
>
> Currently I use MZ-Tools to create the error handler such as this
> however they only allow one error handler and one procudure handler ...
>
> I am hoping to write one "universal" sub that can work with passed
> things like "{PROCEDURE_NAME}" etc.

No, it gets that info by looking at the source and the information
internal to the IDE, most of which is lost when you compile.
While you can create symbolic debug info while compiling, it's not an
easy task to tie up the two and get the location at runtime.

Personally, I just add the error handler and the determined names at
that point:

CheckTimer_Timer_Error:
If Err.Number <> 0 Then GlobalErrorHandler Err, Erl,
"CheckTimer_Timer", "Mainfrm"
End Sub

My GlobalErrorHandler function then just uses the string values passed in.

--
Deanna Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

BeeJ

12/22/2011 7:12:00 PM

0

Yes I do that also and is OK but trying for better. I like challenging
myself.

So how about an add-in that generates some sort of reference list that
gets put into the VB app source code?

Any way within VB to know programmatically where you are? (not a Const,
one in each Sub). Although I guess an Add-In could do that for me.

Interesting thought but no clue how to do all of that.

Any add-in experts out there "listening"?

Sorta Like
For Each Sub
' insert cold line

Const ProcedureIs{PROCEDURE_NAME} as String = {PROCEDURE_NAME}
' etc.

Next Sub

Then in the sub could use it.

Oooooh, the code formatter I am working on (not very sophisticated)
could do that as an option too ... maybe. Hmmm...


GS

12/23/2011 3:52:00 AM

0

I've been using text stored in a file that is pre-written for
modules/forms/classes as well as subs/functions.

The former contains default text which includes the declaration:
Const msModule As String = "<ModuleName>"

The latter contains default text which includes the local const:
Const sSource As String = "<ProcedureName>"

These are primarily used by my central error handler for writing an
app's error log. When I first started using this methodology, I
populated existing docs (.bas, .frm, .cls) via VB file I/O using
Replace() and dumping the revised text back into the file. Of course,
my format was consistent for how I structured my components (all
contained "Option Explicit") and my procedures were revised in a
similar manner starting with the always empty line above the first Dim
statement. The procedures were processed via arrays while the component
docs were processed as a string. Made the whole upgrade a simple task
of looping through project folders one file at a time.<g> Perhaps this
approach might satisfy your needs...

--
Garry

Free usenet access at http://www.eternal-sep...
ClassicVB Users Regroup! comp.lang.basic.visual.misc


Dee Earley

12/23/2011 9:23:00 AM

0

On 22/12/2011 19:12, BeeJ wrote:
> Yes I do that also and is OK but trying for better. I like challenging
> myself.
>
> So how about an add-in that generates some sort of reference list that
> gets put into the VB app source code?
>
> Any way within VB to know programmatically where you are? (not a Const,
> one in each Sub).

No, as I said, that info is discarded at compile time (the closest you
have is Erl which it the line and error occurred)

> Although I guess an Add-In could do that for me.

It MAY be possible to do as a pre compile step but I didn't see anything
that allowed for that in the API exposed by VB.

But that's never stopped addin designers before :)

> Oooooh, the code formatter I am working on (not very sophisticated)
> could do that as an option too ... maybe. Hmmm...

Is a similar idea..

--
Deanna Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Jason Keats

12/26/2011 5:50:00 AM

0

BeeJ wrote:
> Is there a way to access the same information that is accessible in an
> Add-In (code)?
>
> E.g. (a simple indirect example)
> MZ-Tools gets this info.
> (Yes, I know this is their scripting for their Add-In but shows the type
> of info I would like to access.)
>
> On Error GoTo {PROCEDURE_NAME}Err
>
> {PROCEDURE_BODY}
>
> {PROCEDURE_NAME}Exit:
> Exit {PROCEDURE_TYPE}
>
> {PROCEDURE_NAME}Err:
> Debug.Print "{PROCEDURE_NAME} " & Err.Description
> Resume {PROCEDURE_NAME}Exit
>
> Currently I use MZ-Tools to create the error handler such as this
> however they only allow one error handler and one procudure handler ...
>
> I am hoping to write one "universal" sub that can work with passed
> things like "{PROCEDURE_NAME}" etc.
>
> Is that possible? Or do I have to ask MS to add that feature? lol
>
>

I use the HuntERR addin which used to be freely available from
http://www.ur... (they seemingly no longer exist). See:
http://web.archive.org/web/20070214134505/http://www.ur.../UJv3/_main/home.aspx

I've made it available here in case anyone is interested...
http://members.melbpc.org.au/~jkeats/files/Hunt...

Used in conjunction with the line-numbering feature in MZ-Tools you will
get a stack trace showing the line causing the error, which you can
display, or save to a database, or file, or...

I've been using it for years. It's great. Get it while you can.

BeeJ

12/27/2011 10:31:00 PM

0

Thanks. Will study it.