in reply to HTML from Clipboard in Windows

use Win32::Clipboard; my @arr = Win32::Clipboard::EnumFormats(); print "@arr\n"; foreach my $format (@arr) { print "Format: $format\n"; print Win32::Clipboard::GetAs($format); print "\n\n"; }

This shows all available formats and their values. Looks like CF_HTML is 49485 and therefore to get the HTML version of the text in clipgoard you'd use Win32::Clipboard::GetAs(49485).

Not sure why isn't the HTML included in the list of exported constants.

Jenda
Enoch was right!
Enjoy the last years of Rome.

Replies are listed 'Best First'.
Re^2: HTML from Clipboard in Windows
by Corion (Patriarch) on Aug 09, 2017 at 15:08 UTC

    I think it is because CF_HTML is a custom format and you are supposed to register it by name instead of a magic number.

    I've posted some code that does the lookup by name, but your solution is so much nicer and shorter.

    Update: GetClipboardFormatName and EnumClipboardFormats, which I interpret to that regard.