ok, i'm calling GetMOduleFileName from VB.NET. So i declared:
VB Code:
Public Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Integer, ByVal lpFileName As String, ByVal nSize As Integer) As Integer
notice that lpFileName is passed "ByVal". Now here's the thing, lpFileName is a pointer to the buffer that will receive the null terminated string. So shouldn't it be "ByRef"? Because if it's "ByVal", the api function GetModuleFileName will be getting the value instead, right? It should be passing ByRef, yet it only works if its ByVal.




Reply With Quote