获取DLL的函数和返回值 [英] Get function and return value of a DLL
问题描述
我正在尝试为VB.NET制作win32 api列表。我开始获取程序的参数,并通过其前缀(例如,ByVal dwThing As Long - > ByVal dwThing As UInteger)翻译成VB.NET。此时,一切都好(或多或少)。当我必须得到函数的返回值时,问题出现了(我的项目基于VB6 API声明,而且这种语言不能识别无符号类型,我在文件中看不到float或double)。然后我想得到函数名称和一些dll的返回值(如果可以更好地使用过程参数,因为我看到了那些的真正价值)。例如,
BOOL Beep(DWORD dwFreq,DWORD dwDuration); (从MSDN中提取,这可以通过kernel32.dll库获得)
这可以做到吗?
提前致谢。
我的尝试:
我尝试过使用dumpbin.exe,但它没有得到(或者我不知道怎么做)返回值。我只希望函数(带参数和返回值)或subs(带参数)来比较结果并将它们设置为列表。
I'm trying to make a win32 api list for VB.NET. I started getting the parameters of the procedures, and by its prefixes (for example, ByVal dwThing As Long -> ByVal dwThing As UInteger) translated into VB.NET. At this point, all Ok (more or less). The problem comes when I have to get the return value of the functions (I'm basing my project in VB6 API declarations, and this language doesn't recognize unsigned types and I can't see a float or double in the file). Then I want to get the function name and return value of some dlls (if could be with the procedure parameters better, because I see the real value for those). For example,
BOOL Beep(DWORD dwFreq, DWORD dwDuration); (extracted from MSDN, this could be got with the kernel32.dll library)
This could be done?
Thanks in advance.
What I have tried:
I have tried with dumpbin.exe, but it doesn't get (or I don't know how to do it) the return values. I only want the functions (with parameters and return value) or subs (with parameters) to compare results and set them to the list.
推荐答案
VB6上个世纪已停产。切换到VB.NET,然后您可以使用如何:使用PInvoke从托管代码调用本机DLL Microsoft Docs [ ^ ],已完成所有工作。
VB6 was discontinued last century. Switch to VB.NET and you can then use How to: Call Native DLLs from Managed Code Using PInvoke | Microsoft Docs[^], which has done all the work for you.
这篇关于获取DLL的函数和返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!