Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB Expert!

Join 244,304 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 778 people online right now. Registration is fast and FREE... Join Now!




How to identify which function or subroutine is invoked in VB6

 
Reply to this topicStart new topic

How to identify which function or subroutine is invoked in VB6

dineeshd
15 Nov, 2008 - 10:44 PM
Post #1


Group Icon

Joined: 30 Jun, 2008
Posts: 600



Thanked: 25 times
Dream Kudos: 575
My Contributions
Friends, I need a small help.

My question is:

How to identify which function or subroutine is invoked in VB6?

Scenario is like this:

I have a function XYZ (example). I will be calling this function from many functions and subroutines. What I have to know is that from which function or subroutine, XYZ is called.

Any idea?


User is offlineProfile CardPM
+Quote Post


n8wxs
RE: How To Identify Which Function Or Subroutine Is Invoked In VB6
15 Nov, 2008 - 11:17 PM
Post #2

--... ...-- -.. . -. ---.. .-- -..- ...
Group Icon

Joined: 6 Jan, 2008
Posts: 1,609



Thanked: 223 times
My Contributions
Pass in a unique identifier? smile.gif
User is offlineProfile CardPM
+Quote Post

dineeshd
RE: How To Identify Which Function Or Subroutine Is Invoked In VB6
15 Nov, 2008 - 11:26 PM
Post #3


Group Icon

Joined: 30 Jun, 2008
Posts: 600



Thanked: 25 times
Dream Kudos: 575
My Contributions
QUOTE(n8wxs @ 16 Nov, 2008 - 11:47 AM) *

Pass in a unique identifier? smile.gif


Sorry, I didn't got really. Could you be more specific.
User is offlineProfile CardPM
+Quote Post

thava
RE: How To Identify Which Function Or Subroutine Is Invoked In VB6
16 Nov, 2008 - 05:29 AM
Post #4

D.I.C Addict
Group Icon

Joined: 17 Apr, 2007
Posts: 670



Thanked: 35 times
Dream Kudos: 75
My Contributions
hi nice to see you again
one small suggestion

create a optional parameter and pass the functions name as a parameter


or if you want debug the program and just enabled the break point at the end of the function and press F8 this will lead to the calling area of the program



User is offlineProfile CardPM
+Quote Post

born2c0de
RE: How To Identify Which Function Or Subroutine Is Invoked In VB6
17 Nov, 2008 - 02:30 AM
Post #5

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 4,353



Thanked: 81 times
Dream Kudos: 2800
Expert In: J2ME, 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
Here's an example that uses n8wxs' idea:
vb

Private Sub Func1()
XYZ ("func1")
End Sub

Private Sub Func2()
XYZ ("func2")
End Sub

Private Sub XYZ(Optional ByVal calledFrom As String)
MsgBox "XYZ() Called by " & calledFrom
End Sub

User is offlineProfile CardPM
+Quote Post

dineeshd
RE: How To Identify Which Function Or Subroutine Is Invoked In VB6
17 Nov, 2008 - 09:07 AM
Post #6


Group Icon

Joined: 30 Jun, 2008
Posts: 600



Thanked: 25 times
Dream Kudos: 575
My Contributions
Thanks to n8wxs, thava and born2c0de for the reply.

Currently I am using the same method which you suggested, but I want to make it dynamic now.

I am looking for something similar to the below VB.Net code.

CODE
System.Reflection.MethodBase.GetCurrentMethod.Name


Above code will return the function name from where it called. But unfortunately only in .Net not in VB6.

Any idea, how this can be done in VB6?

This post has been edited by dineeshd: 19 Nov, 2008 - 08:23 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 06:08PM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month