Can't get displayName in the Electron

Asked by At

I'm using method to get information about monitors. Then this information goes to C++ Application where it tries to match monitor by ID. The problem is that Electron gives ID which I can't match to a result of the EnumDisplayDevicesA method call.

Electron Display ID:  2528732444

C++ EnumDisplayDevicesA values:
DeviceID: "PCI\\VEN_10DE&DEV_1B81&SUBSYS_33011462&REV_A1"
DeviceKey: "\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\{48210CD6-1F3B-11E9-9541-D05099833422}\\0000"

So Electron ID doesn't match any ID's available by EnumDisplayDevicesA. Is the any possible way to match Electron display to Win API display?

1 Answers

Community On

The id comes from electron's screen object as you already pointed out. That internally uses Chromium's screen (see the #include "ui/display/screen.h". After more digging, I found that the id comes from the method at line 59 of the implementation of It is just a hash generated from the device name which comes from the os, namely from the MonitorInfoEXA struct.

Maybe you can repeat the hash they do to the name and match it with the id though.


where device name is szDevice from this struct.