How to use Intptr as BYTE* or HANDLE*

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mariam Hussien
    New Member
    • Mar 2008
    • 1

    How to use Intptr as BYTE* or HANDLE*

    Hi all
    I have a question about Intptr and how I can use it

    I have a C++ code which do the following:

    DWORD nBufferSize = 0;

    BYTE *pBuffer = NULL;

    hr =GetInfo(&nBuff erSize, &pBuffer, NULL);

    to use the function GetInfo in C# I have to pass the parameter pBuffer as Intptr, I don't know how to initiliaze it to act as a BYTE*?

    The same problem I have with type HANDLE , e C++ code is as the follwoing

    HANDLE *pSampleReadyEv ents = NULL;

    pSampleReadyEve nts =
    (HANDLE*)Alloca teMemory(sizeof (HANDLE) * 100);


    for (DWORD i = 0; i < 100; i++)
    {

    pSampleReadyEve nts[i] = CreateEvent(NUL L, FALSE, FALSE, NULL);

    }
    DWORD nWaitCode = WaitForMultiple Objects(nNumber OfSamples,
    pSampleReadyEve nts,
    FALSE,
    INFINITE);

    IN C# the methods CreateEvent & WaitForMultiple Objects treat pSampleREadyEve nts as Intptr, I also don't know how can I create it to work well?

    by the way it is my first time to post question here,Thanks in advance
Working...