Skip to content

Save CFSTR_FILECONTENTS to file #505

Answered by dahall
Alex4SSB asked this question in Q&A
Jan 31, 2025 · 1 comments · 7 replies
Discussion options

You must be logged in to vote

Do these additions answer your question?

	[Test]
	public void GetDataTest()
	{
		const int cnt = 512;

		byte[] orig;
		using (var fs = File.OpenRead(TestCaseSources.WordDoc))
			orig = GetFileBytes(fs, cnt);
		var obj = new ShellDataObject([new ShellItem(TestCaseSources.WordDoc)]);

		Assert.That(obj.GetDataPresent(ShellClipboardFormat.CFSTR_FILEDESCRIPTORW));
		var fd = obj.GetData(ShellClipboardFormat.CFSTR_FILEDESCRIPTORW, true);
		Assert.That(fd is ShellFileDescriptor[]);
		Assert.That((ShellFileDescriptor[])fd, Has.Exactly(1).Items);
		Assert.That(((ShellFileDescriptor[])fd)[0].Info.Name, Is.EqualTo(Path.GetFileName(TestCaseSources.WordDoc)));

		Assert.That(obj.GetDataPresent(Shell…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@Alex4SSB
Comment options

@dahall
Comment options

@Alex4SSB
Comment options

@dahall
Comment options

Answer selected by Alex4SSB
@Alex4SSB
Comment options

@dahall
Comment options

@Alex4SSB
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants