none
GetMappedFileName VB.NET RRS feed

  • Question

  • Hi All,
    I am trying to convert a code from C to <acronym title="Visual Basic">VB</acronym>.NET.

    I have a function with the following declaration -

    Declare Function GetMappedFileName Lib "psapi" (ByVal hProcess As IntPtr, ByVal lpv As IntPtr, <Out()> ByRef lpFilename As String, ByVal nSize As Long) As Long

    I am calling the function as follows -

    GetMappedFileName(handle, Address, MappedFile, Marshal.SizeOf(MappedFile))

    where MappedFile is declared as -

    Dim MappedFile As String = ""
    MappedFile does not return anything. Any help will be appreciated.

    Thursday, May 5, 2011 3:51 PM

Answers

  • Hi,

    You can try to call the method as below:

     GetMappedFileName(handle, Address, ref MappedFile, Marshal.SizeOf(MappedFile))

    In this way, retrieve value will be cast to MappedFile object.

    I hope this can help you resolve your problem.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Paul Zhou Saturday, May 21, 2011 3:09 AM
    • Marked as answer by Paul Zhou Tuesday, May 24, 2011 6:19 AM
    Tuesday, May 10, 2011 9:28 AM

All replies