Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 20th, 2012  |  syntax: None  |  size: 0.71 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. C# implemenation of IDL declaration with an INT_PTR
  2. [id(7), helpstring("method SomeFunction")] HRESULT SomeFunction([in] INT_PTR windowHandle, [out, retval] VARIANT_BOOL* dlgResult);
  3.        
  4. public bool SomeFunction(int windowHandle)
  5.        
  6. #if WIN64
  7.      long handle;
  8.      public bool SomeFunction(long windowHandle)
  9. #else
  10.      int handle;
  11.      public bool SomeFunction(int windowHandle)
  12. #endif
  13.        
  14. public bool SomeFunction(IntPtr windowHandle)
  15. {
  16.     // Implementation here.
  17.     // If you need the value of the pointer in the implementation,
  18.     // you can use:
  19.     // long actualValue = windowHandle.ToInt64();
  20. }
  21.  
  22. long actualHandle = 1234;
  23. IntPtr handlePtr = new IntPtr(actualHandle);
  24. bool returnValue = SomeFunction(windowHandle);