0

I am using a window handle from a user32 dll -

  [DllImport("user32.dll")]
    private static extern
        bool SetForegroundWindow(IntPtr hWnd);

Some where in my code I write below piece of code to bring the UI to foreground.

        IntPtr hWnd = _processes[n].MainWindowHandle;
        SetForegroundWindow(hWnd);

now, I see IntPtr is a pointer here. Do I need to write something to dealocate the memory?

Thanks a lot in advance.

App
  • 346
  • 3
  • 9
  • Related : http://stackoverflow.com/questions/2299528/c-sharp-deallocate-memory-referenced-by-intptr –  Jul 22 '16 at 11:50
  • You don't have to, because you didn't allocate that memory in this case. – dymanoid Jul 22 '16 at 12:54
  • There is no "memory" being used. You don't deallocate hWnd either, it is not your window. Windows get destroyed when the user or the program closes them. – Hans Passant Jul 22 '16 at 14:21
  • Thanks a lot for the reply...I got it.. – App Jul 22 '16 at 17:05

0 Answers0