halildurmus / win32

Access common Win32 APIs directly from Dart using FFI — no C required!
https://win32.pub
BSD 3-Clause "New" or "Revised" License
753 stars 123 forks source link

Add setupapi.dll #302

Closed krjw-eyev closed 3 years ago

krjw-eyev commented 3 years ago

I have manually added some functions I needed from setupapi.dll to read EDID data (width and height in mm) from attached monitors. I think setupapi.dll could be a great addition to this repo. I could add the code to read EDID data from a monitor to the examples of this repository.

I use SetupDiGetClassDevsW SetupDiDestroyDeviceInfoList SetupDiEnumDeviceInfo SetupDiOpenDevRegKey

I also use GetDeviceCaps from gdi32.dll as an alternative if EDID is not available.

Since I don't know how the generation of these files work and my main machine runs macOS, I kindly ask if this is on the roadmap?

timsneath commented 3 years ago

I've added the specific APIs you mentioned here. There are a lot of other APIs in this DLL, but I'm not sure how valuable or urgent the others are, so I've left them out for now. Let me know if you're missing anything you need.

krjw-eyev commented 3 years ago

Great, thank you very much! I think that is it for now.

Sunbreak commented 2 years ago

@krjw-eyev Could you help review https://github.com/timsneath/win32/pull/383?

Sunbreak commented 2 years ago

@krjw-eyev Could you help review #390? I'm not sure what SetupDiOpenDevRegKey is used for

krjw-eyev commented 2 years ago

Sorry for the late reply. I am using SetupDiOpenDevRegKey and RegEnumValue to read out the EDID information of monitors to get the physical size of the monitor in mm. I believe that SetupDiOpenDevRegKey is used for getting a device specific registry key. In my example I use this: {4d36e96e-e325-11ce-bfc1-08002be10318} which is the monitor class. Do you want me to share my example? I am unfortunately not qualified enough to review #390

Sunbreak commented 2 years ago

Yep. Could you share some example on SetupDiOpenDevRegKey? I'd like to add to the setupapi example

krjw-eyev commented 2 years ago

I have added my example #393 here. I am not sure if that helps but I am not very familiar with win32 API.