开发者

How can I discover the methods available to me in an unmanaged DLL

When doing a dll import like this:

[DllImport("user32.dll")]
    static extern bool SwapMouseButton(bool fSwap开发者_开发知识库);

    private void button1_Click(object sender, EventArgs e)
    {
        SwapMouseButton(false);
    }

How would one go about knowing that there is a method called SwapMouseButton within user32.dll that takes a bool parameter and returns a bool value?

Obviously there is no intellisense to save the day. So is there a website that lists this all out, or a program that I can type user32.dll into that will discover it for me?


`User32.dll' is part of the Windows API itself, and the API is documented at MSDN. The typical way to find things there is to decide what you're trying to do, and then search for that topic.

There's no way to find the parameters for an unmanaged DLL's functions. You can find the name of the functions (usually) with depends.exe (part of VS), or with DependencyWalker. This won't give you the parameters, though; those have to be obtained from the documentation for the library.


You can use depends.exe which comes with Visual Studio. You can load in a dll and it will show you all the functions inside, as well as the dependencies.

You can also try Dumpbin: http://msdn.microsoft.com/en-us/library/c1h23y6c

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜