Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Can you determine a procedure's address from its name?

Posted on 2004-09-27
4
Medium Priority
?
218 Views
Last Modified: 2010-04-23
I am interested in using a method's name (ie MyFunc) to find its address. I know you can use CallByName to actually call the function, but I just want to get its address. I have a delegate and I want to assign it the AddressOf "MyFunc".
0
Comment
Question by:BASESLydia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
123654789987 earned 375 total points
ID: 12159664
u can use the GetAssemblyByName method

Imports System
Imports System.Reflection
Imports System.Text.RegularExpressions
Imports Microsoft.VisualBasic

Public Class AssemblyName_GetAssemblyName
   
   Public Shared Sub Main()
     

      ' Get the type of 'System.Object'.
      Dim myType As Type = GetType(System.Object)
     
      ' Get the path of 'System.dll'.
      Dim system As String = Regex.Replace(myType.Assembly.CodeBase, "mscorlib.dll", "System.dll")
      system = Regex.Replace(system, "file:///", "")
     
      ' Get the assembly information and display to the console.
      Dim myAssemblyName As AssemblyName = AssemblyName.GetAssemblyName(system)
      Console.WriteLine(ControlChars.Cr + "Displaying the assembly information of 'System.dll'" + ControlChars.Cr)
      Console.WriteLine(myAssemblyName.ToString())
   End Sub 'Main
End Class 'AssemblyName_GetAssemblyName

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12170767
What's wrong with AddressOf?

Bob
0
 
LVL 1

Author Comment

by:BASESLydia
ID: 12170815
Unless I am using it wrong, AddressOf requires the function name be typed at runtime, you cannot use a string as a parameter. I would like to load the string name from a database and get the address from it at a runtime.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12170838
Aaah, yes, that one again.  Good luck!

Bob
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question