Windows API,VB.Net GetModuleFileNameEx,找不到入口点

时间:2015-02-15 07:39:55

标签: c++ vb.net winapi

我正在尝试运行以下代码:

Public Class Form1
    Public Declare Function GetModuleFileNameEx Lib "PSAPI.DLL" (ByVal hProcess As Integer, ByVal hModule As Integer, ByRef lpFilename As String, ByVal nSize As Integer) As Integer
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim _intLen As Integer
        Dim lpFilename As String
        Dim nSize As Integer
        lpFilename = ""
        'get process file path
        _intLen = GetModuleFileNameEx(10000, 0, lpFilename, nSize)
    End Sub
End Class

但我一直得到一个entrypointnotfound异常: enter image description here

任何想法?

1 个答案:

答案 0 :(得分:0)

确定找到了解决方案:

Public Class Form1
    Public Declare Function GetModuleFileNameExW Lib "PSAPI.DLL" (ByVal hProcess As Integer, ByVal hModule As Integer, ByRef lpFilename As String, ByVal nSize As Integer) As Integer
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim _intLen As Integer
        Dim lpFilename As String
        Dim nSize As Integer
        lpFilename = ""
        'get process file path
        _intLen = GetModuleFileNameExW(10000, 0, lpFilename, nSize)
    End Sub
End Class