Ejemplo n.º 1
0
        public void GetItemIDTest()
        {
            IntPtr pidl = new IntPtr();
            uint   iAttribute;

            byte[] actual;

            string path = @"F:\Downloaded";

            API.SHParseDisplayName(path, IntPtr.Zero, out pidl, 0, out iAttribute);

            PIDL target = new PIDL(pidl, false); // TODO: Initialize to an appropriate value

            actual = target.GetItemID(0);

            Console.Write(actual.Length.ToString() + "  ");
            for (int i = 0; i < actual.Length; i++)
            {
                Console.Write(actual[i].ToString() + " ");
            }
            Console.WriteLine();


            // next
            path = @"C:\Documents and Settings\Administrator\Desktop";

            API.SHParseDisplayName(path, IntPtr.Zero, out pidl, 0, out iAttribute);

            target = new PIDL(pidl, false); // TODO: Initialize to an appropriate value

            actual = target.GetItemID(0);
            //如何判断byte[] 和null?
            Assert.Equals(actual == null, true);
        }