Closed mbodm closed 11 months ago
The metadata does declare a MONITORINFOF_PRIMARY
constant, so if you add that specifically to your NativeMethods.txt
file, you'll get what you need.
CsWin32 doesn't auto-generate it because the APIs you're asking for don't directly reference constants -- only enums, structs, and the like.
If you feel we should be using an enum here instead of a uint
though, you can open an issue over in the win32metadata repo.
Oh, then i´m sorry!
I didn´t know you can also put in types, structs or consts into the NativeMethods.txt
file. If it´s mentioned in the documentation, i maybe missed that part. Cause of the file name of the.txt
file, i assumed you can only put in function names in there. And everyting else, related to that function(s), is resolved/created automatically. My bad!
Thanks a lot for clarifying this and sorry when i wasted your sparse time!
No worries. FYI the docs on NativeMethods.txt and what it can contain are here: https://github.com/microsoft/CsWin32#usage
No worries. FYI the docs on NativeMethods.txt and what it can contain are here: https://github.com/microsoft/CsWin32#usage
Yeah, it seems i missed that part:
The name of a struct, enum, constant or interface to generate. This may be qualified with a namespace but is only recommended in cases of ambiguity, which CsWin32 will prompt where appropriate.
The name „NativeMethods“ missleaded me to „methods/functions only“.
Anyway, all fine and thx for clarifying!
Actual behavior
Using this code, including the following generated
PInvoke
stuff:The
MONITORINFO
struct contains adwFlags
field. There should be a const/enum or something namedMONITORINFOF_PRIMARY
, to compare thedwFlags
value with.Some other
PInvoke
generated functions have those. Example given:exists along with
function.
In short: There is no
MONITORINFOF_PRIMARY
const/enum.Expected behavior
There should be a
MONITORINFOF_PRIMARY
const/enum.Repro steps
NativeMethods.txt
containing above used function namesMONITORINFO.dwFlags
and look around for someMONITORINFOF_PRIMARY
const/enumContext
0.3.18-beta
.NET 6
C# 10