4 Replies Latest reply on Feb 18, 2014 1:50 AM by thesunnycrow

    Beginner Question: How to read EDID with ADL

    syncro

      Hi,

       

      i am c# beginner and also have no experience with ADL, so i hope this question is not too silly.

       

      I tried to extend the ADL C# Sample ( Sample-Managed ) with the ADL Function ADL_Display_EdidData_Get. Therefore I also  implemented ADLDisplayEDIDData struct, which is in the ADL.cs and looks like:

       

      [StructLayout(LayoutKind.Sequential)]

          internal struct ADLDisplayEDIDData

          {

              internal int Size;

              internal int Flag;

              internal int EDIDSize;

              internal int BlockIndex;

              [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)ADL.ADL_MAX_PATH)]

              internal string EDIDData;

              [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]

              internal int[] Reserved;

          }

       

      In Program.cs i tried this:

       

      if(null != ADL.ADL_Display_EdidData_Get){  

       

          ADLDisplayEDIDData EDIDData = new ADLDisplayEDIDData();

         

          IntPtr EDIDBuffer = IntPtr.Zero;

          int sizee = Marshal.SizeOf(EDIDData);

          EDIDBuffer = Marshal.AllocCoTaskMem((int)sizee);

          Marshal.StructureToPtr(EDIDData, EDIDBuffer, false);

            

          ADLRet = ADL.ADL_Display_EdidData_Get(0, 5, ref EDIDBuffer);

         

          Console.WriteLine("ADLRet: "+ADLRet);

          if (ADL.ADL_SUCCESS == ADLRet)

          {

              Console.WriteLine("success");

          }

          else

          {

              Console.WriteLine("no success");

          }

      }

       

      ADLRet is always -3, which means:

       

      #define ADL_ERR_INVALID_PARAM   -3
      One of the parameter passed is invalid. 

       

      so i guess either the green part is wrong or something in the ADLDisplayEDIDData struct is incorrect. I append the visual studio 2010 project to this post. Would be very nice, if one can help me out.