c# - How to pass a nullable type to a P/invoked function -


I have a P / Inkvend function (but I am rewriting your code at the moment, so I think it I'm writing) and I want to know how to use a tap type / pass type as one of the parameters, working with the int type is not a problem, but the following are given:

< Pre> [DllImport ("setupapi.dll", Charset = Charset Auto, Setlist Error = True)] Static Extern IntPtr Set UpDiGetClassDevs (Referee Gid Classguide, Int. Enumerator, Interactive HWDP, UIIT Flags);

I want to be able to pass the good parameter as an empty type. Right now I can call it as I:

  SetupDiGetClassDevs (Ref Tiguid, blank, IntPtr.Zero, (UIT) SetupDiFlags.DIGCF_PRESENT);  

But I need 1 parameter which is nonsensical.

Thank you for your time. It is not possible to pass a Nullable type in a PInvoke'd function without doing anything.

If you tap to require the ability to have a structure value because Netik address one of your Pinvokd declaration Announces the surcharge which takes an intake in place of the structure and in The passage passes. Zero

  [DllImport ( "setupapi.dll", Charset = CharSet.Auto, SetLastError = true)) stable Extern IntPtr SetupDiGetClassDevs (Refreed Gide Clasguid, referee Intelmetretr, IntPtr hwndParent, uint Flags); [DllImport ( "setupapi.dll", Charset = CharSet.Auto, SetLastError = true)) stable Extern IntPtr SetupDiGetClassDevs (Refreed grid ClassGuid, IntPtr Anyumretr, IntPtr hwndParent, uint Flags);  

Note: I added a ref class for the first signature. If the original signature can tap, then it is likely that an indicator type. So you have to go through the price type according to the context.

Now you can call following the call

  if (enumerator. Hsvalu) {SetupDiGetClassDevs (Kucguid, Refu Anyumemetr. Value, Acdbludi, flag); } Other {SetupDiGetClassDevs (SomeGuid, IntPtr.Zero, hwnd, flags); }  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -