pinvoke Questions

2

I'm trying to capture desktop windows in C# based on Window handles. I'm using .NET and using PInvoke to GetWindowRect() to capture the window rectangle. I've got the Window selection and rectangle...
Sural asked 22/8, 2015 at 18:55

2

Solved

My project run successful without errors in .NET Frame work 3.5. But, When I target it to .NET Frame work 4. I got the error: "A call to PInvoke function has unbalanced the stack. This is likely b...
Kurtzig asked 4/12, 2013 at 10:31

1

I started writing a debugger in C#, to debug any process on my operating system. For now, it only can handle breakpoints (HW, SW, and Memory), but now I wanted to show the opcode of the process. M...
Dismiss asked 2/11, 2015 at 15:51

2

Solved

I'm creating remote task manager app and I'm trying to figure out how to get process owner of process running on remote machine without WMI. With WMI it's really easy, but it's too slow. I'm tried ...
Phrenic asked 28/8, 2019 at 8:56

5

Solved

I have a WinForms project, and if the user want's a debug console, I allocate a console with AllocConsole(). All console output works normally with the target architecture set to "Any CPU", but wh...
Piloting asked 24/3, 2013 at 21:7

5

Solved

Is it possible to detect when a laptop's lid is open or closed? From what I've read, this isn't possible, but SO has helped me with the impossible before. The only thing I've found that might be in...
Canula asked 28/7, 2010 at 17:25

1

Solved

I have a TestNet wrapper for a native component. The native component exposes a blocking TestNative::Foo() that communicates with managed part through calling managed callbacks and a weak GCHandle ...
Dairymaid asked 1/6, 2019 at 9:52

3

Solved

I have a simple c# application that is binding to a library compile with mingnu compiler toolset. I can easily call the functions in the library without issue. However the library calls getenv to ...
Prosaism asked 24/1, 2011 at 23:28

1

I am wrapping a C++ library to be used from .NET. There are functions in the C++ API that return std::future. I want to have the .NET proxy classes return System.Threading.Tasks.Task. I thought of...
Yolondayon asked 15/5, 2019 at 15:15

3

Solved

I want to marshal a structure for use with P/Invoke, but this struct contains a field that is only relevant to my managed code, so I don't want it to be marshaled since it doesn't belong in the nat...
Billingsley asked 9/11, 2009 at 22:13

2

Solved

I am trying to create a 'constructor' for this C# struct (initial attempt included): [StructLayout(LayoutKind.Sequential)] public struct emxArray_real_T { public IntPtr data; public IntPtr size; p...
Albuminate asked 22/2, 2013 at 11:14

1

Solved

I have a PKCS #12 (PFX) file that is a certificate with CNG RSA key and want to export the private key. MIIJ4gIBAzCCCZ4GCSqGSIb3DQEHAaCCCY8EggmLMIIJhzCCBgAGCSqGSIb3DQEHAaCCBfEEggXtMII F6TCCBeUGCyq...
Drunkometer asked 19/3, 2019 at 8:13

2

Solved

I use Win32_DesktopMonitor class of wmi. But this not return monitor name. But when i use Everest(Aida64) this show me it. I think this app's work with winapi. I find method GetMonitorInfo, but not...
Pirri asked 16/10, 2014 at 12:53

1

Solved

I am trying to use GetWindowLongPtrA but I keep getting the "Unable to find an entry point named 'GetWindowLongPtrA' in DLL 'user32.dll'". (also SetWindowLongPtrA getting the same error). I'v...
Cristen asked 22/2, 2019 at 19:36

3

Solved

I'm using the following code to call a TaskDialog. [DllImport("ComCtl32", CharSet = CharSet.Unicode, PreserveSig = false)] internal static extern void TaskDialogIndirect( [In] ref TASKDIALOGCON...
Pomona asked 23/10, 2009 at 9:34

2

Solved

I am trying to make the absolute simplest minimal example of how to pass strings to and from a C++ DLL in C#. My C++ looks like this: using std::string; extern "C" { string concat(string a, str...
Oceanography asked 23/12, 2013 at 22:17

1

I have never created a P/Invoke wrapper method in C# because there's a way to do it "the managed way" using .NET Framework classes. However, I have the need to invoke Win32 API function and I disc...
Alehouse asked 5/2, 2019 at 15:14

2

Solved

I'm using some DllImports in a wpf application to capture the screen. I'm calling GetWindowRect in user32.dll. It requires a rect struct passed to it. The layout of the struct matters, since it's a...
Tilly asked 28/1, 2019 at 9:36

2

I want to pass a structure to C function and I write the following code. When I run it, the first function - Foo1 is working and then function Foo gets an exception. Can you help me to understand ...
Playreader asked 20/2, 2012 at 22:19

3

Solved

Let us say that I am accessing a third-party library, for which the documentation states that I can use pInvoke or create an interop library and use COM. What is the difference between these two te...
Larock asked 29/6, 2010 at 5:6

5

Solved

quick question. I want to find out if a DLL is present in the system where my application is executing. Is this possible in C#? (in a way that would work on ALL Windows OS?) For DLL i mean a non-...
Granddaughter asked 18/2, 2010 at 22:6

1

I'm writing a helper for injecting touch in UI-tests using InjectTouchInput. The injected touch works fine but injecting mouse input after touch does not work. Mouse.Click(point); // works Touch....
Concelebrate asked 6/1, 2019 at 21:9

6

Solved

I was just trying to do some managed/unmanaged interop. To get extended error information I decided to register a log callback offered by the dll: [UnmanagedFunctionPointer(CallingConvention.Cdec...
Callen asked 14/7, 2011 at 14:13

2

I'm trying to use Office Automation (PIA) to convert some .pptx documents into some other formats. However, PowerPoint insists on showing a progress bar even the main window is hidden. Is there an...
Grecoroman asked 24/2, 2011 at 14:22

1

Solved

I can't get this to work for font names that are 16 characters or longer, but the console itself obviously doesn't have this limitation. Does anyone know a programmatic way to set the font that wil...
Padron asked 16/9, 2018 at 17:46

© 2022 - 2024 — McMap. All rights reserved.