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
4 answers

Is it possible to determine if an IntPtr is pointing to a 32-bit or to a 64-bit float?

If an arbitrary IntPtr is received in .NET (C#), is it possible to determine if it is pointing to a 32-bit or 64-bit float and safely convert it to the .NET float type? Or is explicit knowledge of the type required?
denfromufa
  • 5,610
  • 13
  • 81
  • 138
0
votes
2 answers

C# Safe IntPtr Casting

Question Which cast is best for a 4byte IntPtr(strinctly an x84 application) int : Looks like the most logical cast, but is it 'always' safe on x84? uint : Suppose this will work given that all pointers are positive? (As far as i could find in my…
Riaan Walters
  • 2,587
  • 2
  • 18
  • 30
0
votes
1 answer

Pass String in C++ COM dll from C# function

Function Interface of dll; I think in dll function looks like, with datatype BSTR CustomConvert(BSTR dataStr) {........} dll Interface: CustomConvert(IntPtr dataStr) //Returns strings The data I need to pass is something like this: string…
10K35H 5H4KY4
  • 1,496
  • 5
  • 19
  • 41
0
votes
1 answer

Have to send text to focus textbox of other application

I spent many days for sending text value to focused textbox of other application in C#. My code: IntPtr txtLot = FindWindowEx(orderdialog, new IntPtr(0), "Edit", null); SendMessage(txtLot, WM_SETTEXT, 0, lot.ToString()); I want any one solution of…
Praveen
  • 52
  • 1
  • 8
0
votes
1 answer

how to retrieve values from pointer to array of ULONG in C#

Structure in C++: typedef struct _denom { CHAR cCurrencyID[3]; int ulAmount; short usCount; LPULONG lpulValues; //pointer to array of ULONGS int ulCashBox; } DENOMINAT, *…
TechBrkTru
  • 346
  • 1
  • 25
0
votes
1 answer

Reading Byte Array From Delphi Pointer In C#

I have asked question before. Call Delphi Function From C# I have added two methods like this. C# public interface IStringFunctions { [MethodImplAttribute(MethodImplOptions.PreserveSig)] void SetValueAsByteArray(IntPtr DataPointer, int…
İsmail Kocacan
  • 1,204
  • 13
  • 38
0
votes
0 answers

Write image to a specific Device Memory Space defined by an IntPtr

I'd like to write an image from a kernel to a specified place in device memory which I define by an IntPtr. Although it's not directly related to this problem, it's the RenderTexture from Unity which I want to change from inside the kernel in order…
Seneral
  • 327
  • 4
  • 12
0
votes
1 answer

Refreshing a folder that doesn't exist in the file system

In my shell extension I have folders that don't actually exist in the file system, but only appear so to the user. When the content of those folders is changed, I want to refresh them, and currently I do it in the same method I do for regular…
Mugen
  • 8,301
  • 10
  • 62
  • 140
0
votes
2 answers

dynamic way to free intPtr

I have large class which in many places I need to convert array to intPtr IntPtr convertToIntPtr(Array input) { if (input != null) { int s = Marshal.SizeOf(input.GetValue(0).GetType()) * input.Length; System.IntPtr p =…
AMH
  • 6,363
  • 27
  • 84
  • 135
0
votes
2 answers

Operator + cannot be applied to operands of type IntPtr and int - .Net 3.5

The following code (used for looking up DNS TXT records) works fine in .NET 4, however I have had to downgrade the project to .NET 3.5 for various reasons, and now I am being presented with several errors public String DnsGetTxtRecord(String name)…
jim
  • 13
  • 1
  • 6
0
votes
1 answer

Convert IntPtr to an object C#

From my legacy application (running under seperate process) I am sending double values in an object like this #define MYMESSAGECODE (WM_APP + 123 ) typedef struct { float f; double d; } MyDataStruct; MyDataStruct data; data.f = 1.0; data.d…
WAQ
  • 2,556
  • 6
  • 45
  • 86
0
votes
1 answer

Pointer address of intptr

Sorry for asking this silly question but I'm trying to get a address (pointer) of a lib running in a remote process. The address is saved in type intptr but when i print the value i get a huge int. How can i convert it into 0x00000 etc? Example…
basd bfnsa
  • 81
  • 1
  • 10
0
votes
0 answers

Getting bad IntPtr from P/Invoked code

First, I apologize if my title isn't technically accurate. I'm not sure exactly what's happening and that describes it about as well as anything. I am attempting to decode an SSL certificate for a specific use in a program. I p/invoked all of the…
Dirk Dastardly
  • 1,017
  • 2
  • 12
  • 23
0
votes
1 answer

Kernel32 VirtualAllocEx returning IntPtr.Zero Intermittently

We are trying to read the ToolTips from system tray icons and the code is working but is returning zero intermittently for the the method below calling Kernel32.VirtualAllocEx IntPtr ipRemoteBuffer = Kernel32.VirtualAllocEx( hProcess, …
user351711
  • 3,171
  • 5
  • 39
  • 74
0
votes
0 answers

CreateParams Confusion

I am creating a class to simplify designing controls. It's called ControlDrawer and has three private fields: a Point named _location a Bitmap named _innerImage a NativeWindow named _window I have most of the class done, but here's my snagging…
notagull
  • 113
  • 1
  • 1
  • 11