If I open Windows File Explorer and copy a valid image file by right clicking the name and selecting "Copy", PasteFromClipboard always returns False. However, in Paint, if I "select all" and copy an image file, it will save as long as I add an appropriate file extension. I've included code snippets, but if you'd like to see the entire procedure if you wish.
I haven't found a demo that shows code for pasting so if someone can please suggest a course of action it would be very much appreciated.
Before I execute the code below, I make sure the file extension matches the ones allowed in my code. I also enable the "paste" menu, and therefore Ctrl-V, with:
mnuPaste1.Enabled := ImageEnView1.Proc.CanPasteFromClipboard();
This is just a code segment of what I'm having trouble with:
if ImageEnView1.Proc.PasteFromClipboard() then
begin
Application.ProcessMessages;
if (Extn = '.JPG') or (Extn = '.JPEG') then
ImageEnView1.IO.SaveToFileJpeg(gsDocManPath + NewFileName);
if (Extn = '.PNG') then
ImageEnView1.IO.SaveToFilePNG(gsDocManPath + NewFileName);
if (Extn = '.BMP') then
ImageEnView1.IO.SaveToFileBMP(gsDocManPath + NewFileName);
if (Extn = '.TIF') or (Extn = '.TIFF')then
ImageEnView1.IO.SaveToFileTIFF(gsDocManPath + NewFileName);
if (Extn = '.PDF') then
ImageEnView1.IO.SaveToFilePDF(gsDocManPath + NewFileName);
Application.ProcessMessages;
...
{save filename and path in the database.}
end;