Questions tagged [intptr]

IntPtr is a .NET Framework platform-specific type that is used to represent a pointer or a handle.

IntPtr is a .NET Framework platform-specific type that is used to represent a pointer or a handle.

296 questions
0
votes
0 answers

Passing an unmanaged IntPtr across app domains with NetPipes

.NET 4.5, Win 8, 64bit I have an IntPtr to 4 GB unmanaged array. I want to pass it async to a WCF NetPipes Windows Service, which is supposed to read it, push it to DB then deallocate it. I am aware that the caller and the callee are on two…
Adam
  • 3,872
  • 6
  • 36
  • 66
0
votes
1 answer

Winforms Panel and Scrollbar issue

This issue has bugged me for some time - when attempting to scroll down a Panel the bar will not move until the mouse is released (doesn't seem to be a problem in other controls). In this forum…
gchq
  • 1,603
  • 2
  • 27
  • 52
0
votes
1 answer

Finding the IntPtr of the TaskBar

Previously, I asked this question about returning the user to the previous window they were using, but I have found the solution, but it has created another problem. The function that determines the previous window will sometimes work (if a certain…
topherg
  • 4,203
  • 4
  • 37
  • 72
0
votes
0 answers

Access Violation Exception in Marshal.PtrToStructure in vb.net

I have below code snippet, which gets a pointer from a C API which is defined in a dll. Using marshalling I am trying to get the structure array, which is my requirement. _ Public Class…
0
votes
1 answer

looping through IntPtr?

Here is my question: How do I loop through the stuff pointed by an IntPtr in C#? I have C# code calling C++ code. The C++ code returns a pointer to a piece of image buffer. The interface between C# and C++ is an IntPtr variable declared in C# So…
Nick Tsui
  • 524
  • 2
  • 9
  • 29
0
votes
4 answers

C# getting correct IntPtr pointing to already declared variable

I am trying to write/read multibyte array directly to/from file, and was suggested using PInvoke WriteFile/ReadFile. Basically my reading code looks like this now: [DllImport("kernel32.dll", SetLastError = true)] static extern unsafe int…
Istrebitel
  • 2,963
  • 6
  • 34
  • 49
0
votes
1 answer

Does holding the windows handle (IntPtr) in a variable prevent the form from being properly disposed?

I have a class that needs to perform specific actions. Based on the input data, some dialogs might be shown. These dialogs need to be invoked with the parent window's handle so that they're centered correctly etc. private IntPtr…
MoSlo
  • 2,780
  • 4
  • 33
  • 37
0
votes
1 answer

access unmanaged array inside delphi dll from c#

I've got a delphi dll which has a deal with camera and stores video frames to 3d byte-array inside this dll. 3d dimention is needed to implement rgb format, and it is a convenient for dll background (as developer said). So, I have to access that…
ilja
  • 9
  • 1
0
votes
1 answer

How can I convert a System::IntPtr retrieved from unmanaged code, into a Delegate type defined in C++/CLI?

Currently I am working with two layers. One layer is C++/CLI and the other layer is an unmanaged C++ graphics library that I do not have the source to. I pass data to unmanaged code and receive data back in a callback function 'intermediateCallback'…
AAB
  • 674
  • 3
  • 14
  • 27
0
votes
2 answers

Get c++ pointer to c#

i have a c++ dll ,that has some extern function. and its look like this //C++ Code void GetData(byte * pData) { byte a[] = {3,2,1}; pData = a; } and i have use this code in C# side to get data : //C# Code [DllImport(UnmanagedDLLAddress)] public…
mX64
  • 388
  • 1
  • 7
  • 24
0
votes
1 answer

c++ to VB.Net IntPtr Strings

Alright so I have this code, and I pass it to an unmanaged dll, to which I only know the exports, and have some sample code. I'm getting back the correct string, but it's followed by garbage bytes. I'm basically translating code verbatim from a c++…
Kelly Elton
  • 4,373
  • 10
  • 53
  • 97
0
votes
1 answer

Cannot Derefrence IntPtr in C#

I wrote a class that implements the IGroupPolicyObject Interface in COM. one of the method now returns IntPtr object in C#: IntPtr ghKey = objectGPolicy.GetRegistryKey(GpoSectionMachine); I want to derefrence that pointer when using the RegistryKey…
Saher Ahwal
  • 9,015
  • 32
  • 84
  • 152
0
votes
1 answer

.NET 1.1 WSDL - Unable to use IntPtr (WindowsIdentity.Token) as input param on WebMethod (ASMX Web Service)

We're in a strange situation with a legacy winforms VB.NET 1.1 application using ASMX web services. Trying to send a user Token from a WindowsIdentity object as a parameter to a WebMethod. I will be adding a 'HACK:…
Nick Josevski
  • 4,156
  • 3
  • 43
  • 63
0
votes
1 answer

DllImport how to get single values by reference

What's the appropiate signature/marshall attribute to be able to get output params using pointers params? So far I tried this: // Function to calculate the norm of vector. !0 on error. // int err_NormVec(int size, double * vector, double *…
fprades
  • 15
  • 1
  • 8
-1
votes
1 answer

Trying to convert IntPtr to byte array gives me AccessViolationException

I'm trying to serialize my struct and I need to convert IntPtr to byte array. Here's an example: //IntPtr hWnd = this.Handle; int size = Marshal.SizeOf(typeof(IntPtr)); byte[] managedArray = new byte[size]; Marshal.Copy(hWnd, managedArray, 0,…
c00000fd
  • 20,994
  • 29
  • 177
  • 400
1 2 3
19
20