pinvoke Questions

1

Solved

Is there any way of accessing the members of a NativePtr struct and assigning a value to them, much in the same way that you can in C# in the below example? (From MSDN) CoOrds* p = &home; p ...
Saltworks asked 18/11, 2016 at 20:33

1

I`m developing an application in C# associated with Windows clipboard. As there are many disadvantages in Dot Net Clipboard library (STA, Fail to Open Clipboard, etc. ) I dicided to use system API ...
Firearm asked 28/10, 2016 at 16:4

2

Solved

I have recently had to change from using File.Copy() to CopyFileEx and I am struggling to find how to use it. After a lot of googling I found this nice wrapper to use it, but what I need is to get...
Radiometeorograph asked 20/12, 2012 at 16:17

5

Solved

I'm attempting to call the following trivial C function from C#: SIMPLEDLL_API const char* ReturnString() { return "Returning a static string!"; } With the following P/Invoke declaration (with ...
Evvy asked 9/6, 2011 at 22:33

1

Solved

I'm attempting to follow the answer at this question My struct looks like this in C typedef struct drive_info_t { unsigned char drive_alias[32]; } drive_info_t; My function looks like this in...
Disabled asked 28/7, 2016 at 23:11

0

I have recently implemented CreateProcessAsUser. I have been trying to get the output results either redirected or piped to a file. Preferable to stream. I have tried this with no luck Update Req...
Epistemic asked 28/7, 2016 at 13:6

3

Solved

In this question I have searched for a simple solution to unblock files. Thanks to all the comments and answer, I have found a simple solution by PInvoking DeleteFile. It works, but because I've n...
Hornbeam asked 16/6, 2011 at 16:49

2

I tested different ways of generating a timestamp when I found something surprising (to me). Calling Windows's GetSystemTimeAsFileTime using P/Invoke is about 3x slower than calling DateTime.UtcNo...
Afflatus asked 18/6, 2016 at 15:22

3

Solved

I am using CreateProcessAsUser from a windows service (please can we stay on-topic and assume I have a very good reason for doing this). Contrary to what everyone else is asking here I am getting a...
Fulminous asked 1/2, 2012 at 12:35

5

Solved

The SP_DEVICE_INTERFACE_DETAIL_DATA structure: typedef struct _SP_DEVICE_INTERFACE_DETAIL_DATA { DWORD cbSize; TCHAR DevicePath[ANYSIZE_ARRAY]; } SP_DEVICE_INTERFACE_DETAIL_DATA, *PSP_DEVICE_INT...
Osage asked 23/5, 2012 at 22:13

1

I am trying to create some vhd/vhdx files using the VHD API in C#. There's a C++ union that looks like this: typedef struct _CREATE_VIRTUAL_DISK_PARAMETERS { CREATE_VIRTUAL_DISK_VERSION Version;...
Horsa asked 4/6, 2016 at 0:3

5

Solved

I just switched to vs2010 from vs2008. Exact same solution, except now every single call to a C++ dll yields a 'pinvokestackimbalance' exception. This exception does not get fired in 2008. I have ...
Coucal asked 17/8, 2010 at 20:45

2

Solved

I am able to set a windows position as topmost and also setting it no topmost with SetWindowPos. But i can't figure out how to check if a window is topmost or not. Is there any Method to check if a...
Emmanuel asked 30/4, 2016 at 8:25

4

Solved

I'm struggling to put together a working example of pinvoke'ing CreateJobObject and SetInformationJobObject. Through various google searches (including Russian and Chinese posts!) I've cobbled toge...
Diamagnet asked 7/6, 2011 at 14:31

6

Solved

I have a dll that was written in c++, I need to use this dll in my c# code. After searching I found that using P/Invoke would give me access to the function I need, but these functions are defined ...
Chad asked 24/11, 2008 at 18:49

2

Solved

I have developed a function which returns the icon of the window for a given window handle. It looks like this. private static BitmapSource GetWindowIcon(IntPtr windowHandle) { var hIcon = defaul...
Kurgan asked 20/8, 2015 at 15:44

6

Solved

Hopefully this is a brainlessly easy question, but it shows my lack of expertise with C++. I'm a C# programmer, and I've done extensive work with P/Invoke in the past with other people's C++/C dlls...
Akkadian asked 7/10, 2009 at 20:15

4

Solved

https://msdn.microsoft.com/en-us/library/ms182161.aspx Are the three classes described on this paged handled specially in the .NET Framework? (NativeMethods, SafeNativeMethods and UnsafeNativeMeth...
Cornaceous asked 18/9, 2009 at 15:1

2

Google Chrome does not refresh accessibility elements (AutomationElement) when a user scrolls down in the browser. To reproduce it: Enable renderer accessibility with : "chrome --force-render-...
Picaresque asked 25/5, 2015 at 9:19

1

Solved

When interacting with a 64-bit native library through an explicitly 64-bit .NET application via P/Invoke, is the CallingConvention property in the DllImport attribute effectively ignored? I ask th...
Malaria asked 16/1, 2016 at 22:7

2

Solved

When doing P/Invoke, it is important to make the data layout match. We can control the layout of struct by using some attribute. For example: struct MyStruct { public bool f; } gives a size ...
Markle asked 7/1, 2016 at 5:20

1

Solved

I want to make an SS application. But I have problem on this subject. I want user to be able to select a special area to take screenshot. I also want the desktop is live while the user is selecting...
Vasily asked 19/12, 2015 at 16:3

1

Solved

I'm trying to make something in C# that requires calling into some unmanaged DLLs, a process which I know nothing about! I found a "Hello World" tutorial that should be as simple as copying and pas...
Nonentity asked 16/12, 2015 at 1:54

4

Solved

I'm messing around with some windows functions using p/invoke. Occasionally, I get an error code that is not ERROR_SUCCESS (such an odd name). Is there a way to look these up within the program? F...
Linkous asked 30/10, 2009 at 16:19

1

Solved

How to enumerate all the process' domains without referencing mscoree. Is it possible? I found some solution from 2007 year somewhere in the Internet. But it enumerates and empty collection. Here'...
Delicate asked 24/11, 2015 at 9:47

© 2022 - 2024 — McMap. All rights reserved.