Is this possible? If yes, how would you do it?
Printable View
Is this possible? If yes, how would you do it?
What is it that you're trying to accomplish exactly?
The documentation for this API states that you must pass the module name to it as its own parameter. Which can be obtained via the framework very easily. My process manager can assist with that part.
But this API, as far as I understand, will only give you the readable information. You can't actually do anything with it.
Code:Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Integer, ByVal lpProcName As String) As Integer
I tried that code, and it didn't show a messagebox. Whats wrong?Code:MessageBox.Show( GetProcAddress(GetModuleHandle("insertdllnamehere.dll"), "Notepad"))
Have you tried your test without the GetProcAddress function? Narrow it down to determine what is and isn't working.
Also, you still haven't answered the original question. What is the end result?
End Result: Why do you want to know how to do this? What are you going to do this for?
A HMODULE is only valid in the process containing the module, its there address where the the module is loaded into the process.
You can get the base address of the module in an external process in .net using the Process class e.g.
Process.GetCurrentProcess.Modules(0).BaseAddress
But as asked above, whats this for since GetModuleHandle probably isnt what your looking for