: : This works fine most of the time, however sometimes (like with files copied from windows explorer) it returns a value that is *LESS* than the size it should be.
: Have you tried dumping the data (to a file, for example) to see what it is? Files copied from Windows Explorer are not stored as content, but merely their filename (and half a dozen OLE drag-drop formats).
I realize that the actual file is not copied to the clipboard. The GlobalSize function returns 32 for the size of clipboard items that are copied from windows explorer. I have tried dumping the data (the 32 bytes) that I get from the clipboard into a file, but it is not complete. I know that it is not complete because I used the clipboard viewer to save the clipboard to a .clp file, and then used a hex editor to search the .clp file for the values that were at the beginning of the file that I dumped from my program. I searched the .clp file for these values and found them after what I assume is the header to the .clp file, but there is more data after the 32 bytes that my program reads. The data after those 32 bytes contains the file path and name. This is why I assume it is a problem in reading size of the clipboard memory.
The program that I am writing is supposed to be able to copy the contents of the clipboard and put them back on the clipboard, and it works fine with other clipboard data. I think it would work fine for th "files" copied from windows explorer also if I could read all the data.
The program is eventually going to allow you to store the last however many number of clipboard "clips" and restore them back onto the clipboard. There are other programs that do this or something similar...