> registered format, how do I do that not knowing what the format is? I > haven't found anyway to use the numeric constants for these special > types...it seems you need to know the CF_ constant type?
What does "the CF_ constant type" mean? The format id's are just numbers. Take a look at RegisterClipboardFormat() in the Win32 help. You /are/ programming for windows correct? :) What does "CF_" have to do with anything. So there are a number of commonly used "numbers" that have been turned into convenient constants for us. That doesn't change the game does it? > And there is no > listing I can find to use for converting from one to the > other! Converting from one what to one what? A number's a number's a number! But if you want to store this data and this format you need to spend some time learning about the windows clipboard and reading the help file or similar on MSDN. I'm not aware that custom clipboard formats are persistent across reboots, so placing this data into a database is one thing but I don't think you can just expect to later "upload" it back to the clipboard willy-nilly. You'll also want to take a look at GetClipboardFormatName. The id windows returns for a format is at it's discretion, the format string itself is your only real way of insuring you can re-register that exact format across a reboot. Also, how > can I save what is on the clipboard to a stream so it can be > loaded into a > blob along with it's format type so I can then load it back into the > clipboard later? There's nothing in the Clipbrd unit that I > can use for that. You can look at SetAsHandle of TClipboard. But Delphi's pointer shielding makes this method fairly confusing at first. The bottom line, once you have the format registered, you're simply calling SetClipboardData() through this Delphi method. The whole "AsHandle" naming thing just adds to the confusion. The focus shouldn't be on the Handle, or the delphi pointer, but on what it actually is you're doing. For that read up on SetClipboardData(). > Since I only seem to be able to get the format in a > numeric value, I > guess I'll have to set up a name=value pair or something like > that that I > can refer to in code to get the exact format and then save > that in it's CF_ > form as a string value in my dB so that I know what format it > is when I > reload the clipboard. Boy I don't even follow this stuff. Again with the CF_ form. I don't know what you're misunderstanding but a numeric constant is just an alias, if you will, for that particular value. You're not "getting the format in a numeric value." When a format is registered you provide a text name for the format, and if windows accepts it, it becomes a registered format and windows returns to you the id of the format that you can use later to quickly and easier refer to that format. It's like turning in your coat at a restaurant and getting a little tag in its place. You don't actually have the coat, and you don't actually "have" the format. I still don't know what you mean by name=value. Either way, if you try and store anything with any long-term persistence what you want really is the format name and the data. Like a HWND the id is your return tag from windows and you can't depend on an HWND always referring to a specific window if that window is destroyed and recreated. > As per the code included in the first part of this > thread I have to then get the format as a THandle. Does that > sound right or is there a simpler way? The format and the Handle referred to by Delphi's TClipboard class are completely different things. You may want to take a closer look. > And finally, also from the code, I have to use a > pointer to the data > on the clipboard and save that to a stream and back again. > But try as I > might I do not seem to be able to get the syntax correct for > doing this. > I've read and re-read the sections on using pointers but I'm missing > something! Try re-reading the threads that have already discussed pointers on these lists. I've said plenty about them over the years. They're not mystical, they're straight-forward and hardly just a little different from any other variable. Start by fixing the problem above, the format ID is completely different from the pointer you need to provide to the data (or the Handle, in Delphi-speak.) So the "pointer" you need is simply the address of the start of the block of data. You're familiar with the '@' symbol then? I saw you recently post some code that called GlobalAlloc, call any of the memory allocation routines, you realize they simply return a pointer to your memory then right? A pointer is just a number, store it in a variable just like you'd store anything, and pass it to windows to set your clipboard data. Regards, ------------------------------------------------------------------------ Jim Burns, <mailto:[EMAIL PROTECTED]> Technology Dynamics Pearland, Texas USA 281 485-0410 / 281 813-6939 _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

