Post by just me » 23 Dec 2014, 16:46
Das ist witzig (oder auch nicht). Wenn Du Dir das mal als Hexwert anschaust, liefert
-570425343 ->
FFFFFFFF DE000001 und
-570425342 ->
FFFFFFFF DE000002.
Ich habe einen Onboard Intel-Grafikchip und zusätzlich einen NVIDIA Chip, der nur mit einem Ausgang verbunden ist. Der Ausgang für den Intel-Chip und das Notebookdisplay, das auch am Intel-Chip hängt, liefern natürlich nichts bzw.
-6. Der Ausgang für die NVIDIA-Grafik, der nicht mit einem Monitor verbunden ist, liefert allerdings für
EnumNvidiaUnAttachedDisplayHandle()
FFFFFFFF CC000003,
und für
GetUnAttachedAssociatedDisplayName()
\\.\DISPLAY3.
Das klappt allerdings mit 64-Bit - wie schon gesagt - nur dann, wenn ich als Typ für
DispHandle in
EnumNvidiaUnAttachedDisplayHandle() entweder
UIntP,
PtrP oder
UPtrP bzw. ihre
* Equivalente wähle. Warum Dir für
GetAssociatedNvidiaDisplayName() -6 geliefert wird, verstehe ich nicht.
Lass doch das mal bei Dir laufen:
Code: Select all
; ======================================================================================================================
; Namespace: Display_EnumDevices()
; Function: Retrieves information about the display devices in the current session.
; AHK version: AHK 1.1.+ (required)
; Language: English
; Tested on: Win 7 x64/U64
; Version: 1.0.00.00/2013-07-20/just me
; MSDN: http://msdn.microsoft.com/en-us/library/dd162609(v=vs.85).aspx
; ======================================================================================================================
; This software is provided 'as-is', without any express or implied warranty.
; In no event will the authors be held liable for any damages arising from the use of this software.
; ======================================================================================================================
; ======================================================================================================================
Display_EnumDevices() {
; ===================================================================================================================
; MS constants
; Flags:
; ATTACHED_TO_DESKTOP = 0x00000001
; DISCONNECT = 0x02000000
; MIRRORING_DRIVER = 0x00000008
; MODESPRUNED = 0x08000000
; MULTI_DRIVER = 0x00000002
; PRIMARY_DEVICE = 0x00000004
; REMOTE = 0x04000000
; REMOVABLE = 0x00000020
; TS_COMPATIBLE = 0x00200000
; UNSAFE_MODES_ON = 0x00080000 ; Vista+
; VGA_COMPATIBLE = 0x00000010
; ===================================================================================================================
; AHK constants
; DISPLAY_DEVICE structure -> http://msdn.microsoft.com/en-us/library/dd183569(v=vs.85).aspx
Static cbTCHAR := A_IsUnicode? 2 : 1
Static cbDISPDEV := 4 + 4 + ((32 + 128 + 128 + 128) * cbTCHAR)
Static offName := 4
Static offString := offName + (32 * cbTCHAR)
Static offFlags := offString + (128 * cbTCHAR)
Static offID := offFlags + 4
Static offKey := offID + (128 * cbTCHAR)
; ===================================================================================================================
; Create the DISPLAY_DEVICE structure
VarSetCapacity(DD, cbDISPDEV, 0)
NumPut(cbDISPDEV, DD, 0, "UInt")
Devices := []
While DllCall("User32.dll\EnumDisplayDevices", "Ptr", 0, "UInt", A_Index - 1, "Ptr", &DD, "UInt", 0, "UInt") {
Devices.Insert({Name: StrGet(&DD + offName, 32)
, String: StrGet(&DD + offString, 128)
, ID: StrGet(&DD + offID, 128)
, Key: StrGet(&DD + offKey, 128)
, Flags: NumGet(DD, offFlags, "UInt")})
VarSetCapacity(DD, cbDISPDEV, 0)
NumPut(cbDISPDEV, DD, 0, "UInt")
}
Return Devices
}
; ======================================================================================================================
; Sample code
#NoEnv
SetBatchLines, -1
DisplayDevices := Display_EnumDevices()
For I, Device In DisplayDevices {
Msg := ""
Msg .= "Name: " . Device.Name . "`r`n"
Msg .= "String: " . Device.String . "`r`n"
Msg .= "ID: " . Device.ID . "`r`n"
Msg .= "Key: " . Device.Key . "`r`n"
Msg .= "Flags: " . Device.Flags
MsgBox, 0, Device #I, %Msg%
}
ExitApp
; ======================================================================================================================
Welcher Grafikchip wird bei Dir ausgegeben?
Das ist witzig (oder auch nicht). Wenn Du Dir das mal als Hexwert anschaust, liefert
[c]-570425343[/c] -> [c]FFFFFFFF[/c] [c]DE00000[b][color=#BF0000]1[/color][/b][/c] und
[c]-570425342[/c] -> [c]FFFFFFFF[/c] [c]DE00000[b][color=#BF0000]2[/color][/b][/c].
Ich habe einen Onboard Intel-Grafikchip und zusätzlich einen NVIDIA Chip, der nur mit einem Ausgang verbunden ist. Der Ausgang für den Intel-Chip und das Notebookdisplay, das auch am Intel-Chip hängt, liefern natürlich nichts bzw. [c]-6[/c]. Der Ausgang für die NVIDIA-Grafik, der nicht mit einem Monitor verbunden ist, liefert allerdings für [c]EnumNvidiaUnAttachedDisplayHandle()[/c]
[c]FFFFFFFF[/c] [c]CC00000[b][color=#BF0000]3[/color][/b][/c],
und für [c]GetUnAttachedAssociatedDisplayName()[/c]
[c]\\.\DISPLAY[b][color=#BF0000]3[/color][/b][/c].
Das klappt allerdings mit 64-Bit - wie schon gesagt - nur dann, wenn ich als Typ für [c]DispHandle[/c] in [c]EnumNvidiaUnAttachedDisplayHandle()[/c] entweder [c]UIntP[/c], [c]PtrP[/c] oder [c]UPtrP[/c] bzw. ihre [c]*[/c] Equivalente wähle. Warum Dir für [c]GetAssociatedNvidiaDisplayName()[/c] [c]-6[/c] geliefert wird, verstehe ich nicht.
Lass doch das mal bei Dir laufen:
[code=autohotkey]; ======================================================================================================================
; Namespace: Display_EnumDevices()
; Function: Retrieves information about the display devices in the current session.
; AHK version: AHK 1.1.+ (required)
; Language: English
; Tested on: Win 7 x64/U64
; Version: 1.0.00.00/2013-07-20/just me
; MSDN: http://msdn.microsoft.com/en-us/library/dd162609(v=vs.85).aspx
; ======================================================================================================================
; This software is provided 'as-is', without any express or implied warranty.
; In no event will the authors be held liable for any damages arising from the use of this software.
; ======================================================================================================================
; ======================================================================================================================
Display_EnumDevices() {
; ===================================================================================================================
; MS constants
; Flags:
; ATTACHED_TO_DESKTOP = 0x00000001
; DISCONNECT = 0x02000000
; MIRRORING_DRIVER = 0x00000008
; MODESPRUNED = 0x08000000
; MULTI_DRIVER = 0x00000002
; PRIMARY_DEVICE = 0x00000004
; REMOTE = 0x04000000
; REMOVABLE = 0x00000020
; TS_COMPATIBLE = 0x00200000
; UNSAFE_MODES_ON = 0x00080000 ; Vista+
; VGA_COMPATIBLE = 0x00000010
; ===================================================================================================================
; AHK constants
; DISPLAY_DEVICE structure -> http://msdn.microsoft.com/en-us/library/dd183569(v=vs.85).aspx
Static cbTCHAR := A_IsUnicode? 2 : 1
Static cbDISPDEV := 4 + 4 + ((32 + 128 + 128 + 128) * cbTCHAR)
Static offName := 4
Static offString := offName + (32 * cbTCHAR)
Static offFlags := offString + (128 * cbTCHAR)
Static offID := offFlags + 4
Static offKey := offID + (128 * cbTCHAR)
; ===================================================================================================================
; Create the DISPLAY_DEVICE structure
VarSetCapacity(DD, cbDISPDEV, 0)
NumPut(cbDISPDEV, DD, 0, "UInt")
Devices := []
While DllCall("User32.dll\EnumDisplayDevices", "Ptr", 0, "UInt", A_Index - 1, "Ptr", &DD, "UInt", 0, "UInt") {
Devices.Insert({Name: StrGet(&DD + offName, 32)
, String: StrGet(&DD + offString, 128)
, ID: StrGet(&DD + offID, 128)
, Key: StrGet(&DD + offKey, 128)
, Flags: NumGet(DD, offFlags, "UInt")})
VarSetCapacity(DD, cbDISPDEV, 0)
NumPut(cbDISPDEV, DD, 0, "UInt")
}
Return Devices
}
; ======================================================================================================================
; Sample code
#NoEnv
SetBatchLines, -1
DisplayDevices := Display_EnumDevices()
For I, Device In DisplayDevices {
Msg := ""
Msg .= "Name: " . Device.Name . "`r`n"
Msg .= "String: " . Device.String . "`r`n"
Msg .= "ID: " . Device.ID . "`r`n"
Msg .= "Key: " . Device.Key . "`r`n"
Msg .= "Flags: " . Device.Flags
MsgBox, 0, Device #I, %Msg%
}
ExitApp
; ======================================================================================================================[/code]Welcher Grafikchip wird bei Dir ausgegeben?