dotnet / dotnet/wpf

User32.dll RegisterClipboardFormat returns a negative ID

Open
#9,848 8 comments 0 reactions 0 assignees View on GitHub
:mailbox_with_no_mail: waiting-author-feedback Needs minimal repro project
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/User32dll-RegisterClipboardFormat-retur/10748457)._

---
[severity:It's more difficult to complete my work]
I am running into some edge cases in my application where registering a clipboard format returns a negative format ID, so the DataFormat that is created has a negative ID.

When this happens, if I call `Clipboard.ContainsData()` with my formats, it returns false, even though the formats are in the _formatList and they are on the clipboard.

What causes the format ID to be negative?

![image.png](https://aka.ms/dc/image?name=B8eb7618197cd44088238ee2b4e704656638622847585843313_20240918-153237-image.png&tid=8eb7618197cd44088238ee2b4e704656638622847585843313)

---
### Original Comments

#### Feedback Bot on 9/19/2024, 06:55 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.