Re: Second monitor enumeration

new topic     » goto parent     » topic index » view thread      » older message » newer message
AndyDrummond said...

ddret     = w32Func(xEnumDisplayDevicesA, {VOID, 1, ddptr, 1}) -- I also tried NULL where I have VOID 

Is this a valid way to call the function??

Don't ever use VOID like that. It is a "junkyard", and will contain whatever crud from who-knows-what. Use NULL instead.

I've not done much with multiple monitors (and gave up on win32lib a looooooooooonnnngg time ago) so I can't go much beyond this, but it's a start:

constant sizeDD = 424, 
         DD_DeviceName = 4, 
         DD_DeviceString = 36, 
         DD_StateFlags = 164, 
         pDD = allocate(sizeDD), 
         user32 = open_dll("user32.dll"), 
         xEnumDisplayDevices = define_c_func(user32,"EnumDisplayDevicesA",{C_PTR,C_DWORD,C_PTR,C_DWORD},C_BOOL) 
for iDevNum=0 to 9999 do 
    if not c_func(xEnumDisplayDevices,{NULL,iDevNum,pDD,EDD_GET_DEVICE_INTERFACE_NAME}) then exit end if 
    string device_name = peek_string(pDD+DD_DeviceName) 
    atom pDeviceName = allocate_string(device_name) 
    for jDevNum=0 to 9999 do 
        if not c_func(xEnumDisplayDevices,{pDeviceName,jDevNum,pDD,EDD_GET_DEVICE_INTERFACE_NAME}) then exit end if 
    end for 
end for 

I get

"BenQ GL2450H" 
I suspect I do indeed have two adapters but only one physical display device. I don't know what the flags are, and as you say there is no width/height, so... I am probably using EDD_GET_DEVICE_INTERFACE_NAME all wrong to boot.

new topic     » goto parent     » topic index » view thread      » older message » newer message


Quick Links

User menu

Not signed in.

Misc Menu