|
-
December 18th, 2003, 03:37 AM
#1
How to use Function After Calling GetProcAddress()
Hi everyone.
I don't know to use Function(...) after calling GetProcAddress(hmodule, Function(...))
My code :
DllImport("Kernel32.dll")]
public static extern System.IntPtr LoadLibrary(string NameDLL);
DllImport("Kernel32.dll")]
public static extern System.IntPtr GetProcAddress( IntPtr hModule, string FunctionName);
.......
IntPtr temp = LoadLibrary("MyDLL.DLL");
"?" = GetProcAddress( temp, "FunctionName");
....
How to use "FunctionName" ?
please tell me.
thank you.
-
December 18th, 2003, 08:28 AM
#2
I'm not sure how C# handles pointers, which is what you'd need to use for the return for GetProcAddress. This appears to be a workable way to dynamically load a function from a DLL:
Code:
public enum TernaryRasterOperations
{
// enums for raster ops
}
[DllImport("gdi32.dll", ExactSpelling=true, SetLastError=true)]
public static extern Bool BitBlt(IntPtr hObject, int nXDest, int nYDest,
int nWidth, int nHeight, IntPtr hObjSource, int nXSrc, int nYSrc, TernaryRasterOperations dwRop);
Then you just call the function...
Last edited by bytz; December 18th, 2003 at 09:42 AM.
bytz
--This signature left intentionally blank--
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|