|
Hello,
I'm looking for a way to perform pointer operations in C# or .NET in particular.
I want to do something very simple
Having a pointer IntPtr I want to get IntPtr object which points to 2 bytes ahead.
I read some post that the foolowing snippet will...
Started by Marcin Rybacki on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
IntPtr ptr = new IntPtr(oldptr.ToInt64() + 2);
This add static IntPtrExtensions { public static IntPtr Add( this IntPtr ptr, int offSet ) { IntPtr ret = new IntPtr....
Problem on 64 bits version of the .NET framework.
|
|
In c#, I have a handle to a window ( an IntPtr ), I want to change the background color of that window. How can I do this?
I can get the GDI graphics object for that handle like so:
Graphics graphics = Graphics.FromHwnd(theHandle);
So I should somehow...
Started by zadam on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
(); } private void Form1_Load(object sender, EventArgs e) { IntPtr hWnd = this.Handle; Graphics System.Runtime.InteropServices;
public class NativeWIN32
{ [DllImport("gdi32")] public static extern int SetBkColor(IntPtr windowGraphics....
|
|
Probably a noob question but interop isn't one of my strong points yet.
Aside from limiting the number of overloads is there any reason I should declare my DllImports like:
[DllImport("user32.dll")] public static extern int SendMessage(IntPtr hWnd, int...
Started by Cory Charlton on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
IntPtr defined item] ."
If null (or IntPtr.Zero for IntPtr parameters) really is an invalid parameter an overload that takes IntPtr [DllImport....
By-ref is often enough for simple type and simple structure .
I don't see any drawbacks.
|
Ask your Facebook Friends
|
I would really appreciate any suggestions, no matter how simple or complex, to help me get this issue isolated and resolved.
I have a bit of code that generates small report files. For each file in the collection, a stored proc is executed to get the ...
Started by StingyJack on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
At System.Threading.Monitor.Enter(Object obj) at System.Data.SqlClient.TdsParser.get_Errors.
Aborted.
|
|
We have a COM object implemented with C++/ATL that includes a method which will return a DIB. We are also writing a .NET application that will use this COM object. Since we are writing both, we have the liberty of deciding how best to return this DIB ...
Started by Karim on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
This....
You can get it to build one to the calling program.
COM provides an implementation of these interfaces for you.
COM/OLE has a standard IPictureDisp ).
The idea is that the DIB is represented using a IntPtr.
From a DIB to a Bitmap.
|
|
Is there any way to get a BITMAPV5HEADER out of a Bitmap object in C#? Or just get the values that are in their? I need to get some ColorSpace information out of a bitmap and can't see a way to do this in C#.
Started by Kris Erickson on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
BV5ClrImportant; uint bV5RedMask; uint bV5GreenMask; uint bV5BlueMask; uint bV5AlphaMask; uint bV5CSType; IntPtr.
|
|
I have various classes that wrap an IntPtr . They don't store their own data (other than the pointer), but instead use properties and methods to expose the data at the pointer using an unmanaged library. It works well, but I've gotten to the point where...
Started by David Brown on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
To by the pointer?
Reusing the same object is not necessarily a threading issue, although if you are responsible.
|
|
In a VB.NET WinForms project I get an exception "Cannot access a disposed object" when closing a form. It occurs very rarely and I cannot recreate it on demand. The stack trace looks like this:
Cannot access a disposed object. Object name: 'dbiSchedule...
Started by beta tester ben on
, 12 posts
by 11 people.
Answer Snippets (Read the full thread at stackoverflow):
The dbiSchedule....
What you can do the form is being closed.
What will happen is that you'll get one more tick that you may not be expecting.
Another place you.
But don't call control methods
OR stop the timer thread BEFORE disposing the object.
|
|
I was programming normally when I realized that its probably not perfectly safe to assume an int is going to be a pointer to something 4 bytes in length.
Because Some of the aspects of C++’s fundamental types, such as the size of an int, are implementation...
Started by bobobobo on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
On each and every platform....
By far the easiest solution is to get a char* to a char[4] .
One assumptions are violated in future you'll know.
For storing pointers as integers, use intptr_t , defined in the same header.
Cstdint.hpp>.
|
|
Hi all,
my form1 class contains a bunch of data that I need to save, so there should only be one instance of it running at a time.
public partial class Form1 : Form { public string form1string = "I really need to save this data"; public Form1() { InitializeComponent...
Started by cksubs on
, 5 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Static Form1 instance; public static Form1 Instance { get { if (instance == null) { instance = new need to add an additional parameter to your static method:
private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr....
|