Tried that and got this
Compile Project, Mode: Debug, Target: project1.exe: Exit code 1, Errors: 4, Hints: 4
unit1.pas(64,66) Error: Incompatible type for arg no. 2: Got "Pointer", expected "LongWord"
unit1.pas(44,15) Hint: Found declaration: GetNumberOfPhysicalMonitorsFromHMONITOR(QWord;LongWord):Boolean; StdCall;
Is my declaration of the function correct?
No, the declaration is not correct. It should be :
function GetNumberOfPhysicalMonitorsFromHMONITOR(HMONITOR: HMONITOR;
pwNumberOfPhysicalMonitors : PDWORD): boolean;
stdcall; external 'Dxva2.dll' Name 'GetNumberOfPhysicalMonitorsFromHMONITOR';
Note that pwNumberOfPhysicalMonitors is declared with the type PDWORD, not DWORD (as you declared it)
With that declaration, the example @Warfley provided should work.
HTH.
ETA:Personally, I'd recommend
not specifying the name, that way it's almost instantaneous to know that the declared name matches the dll's name. Following that convention makes it clear that whenever the name is specified, the function name is an alias for the dll's function name (which can be useful to know.)