Here you are:

>>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?  :)

Reply:  All the code I came across used the string constants after
converting from the integers.

>>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?

Reply:  Perhaps I missed the call to use them directly without conversion?
  
>>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.

Reply:  That's correct, from what I read specially registered formats are
not persistent...in fact I believe once the window relinquishes control of
the clipboard that info may be gone...I have to check that part out!
 
>>You can look at SetAsHandle of TClipboard.  But Delphi's pointer shielding
>>makes this method fairly confusing at first.

Reply:  I'm finding this to be true! <g>

>>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().


>From original message:
        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.

Reply:
        As I was not able to get the constant directly, only the numeric
alias, I thought I might set up an alias = format stringlist.  This all has
to be handled within the program.  The user isn't going to have or know this
information!  
        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. 


Reply:  Yes, and I thought I DID understand it but when I attempted
dereferencing the pointer I couldn't compile it!  And I followed the
examples I found almost directly so somewhere along the line I've missed
some thing!  I've never really used pointers except where they were part of
an API call or in code I copied as I never really had much of a need for
them, and that's why I've always said I don't want example code just pseudo
code when I ask questions here, so that I learn better what and why
something is done a particular way.  I'm going to sit down and write some
basic code using pointers and make sure I have it down before I go back to
this.  Evidently the added complexity of the clipboard is confusing me.  To
be honest, I found code on the net that does pretty much everything I want
but I didn't download it because I want to figure this out myself and make
sure I understand it!  So please bear with me if I ask these somewhat dumb
questions. <g>      

Regards,


>From "Robert Meek" 
Personal e-mail:  [EMAIL PROTECTED]
dba / "Tangentals Design"
Visit us at:  www.TangentalsDesign.com
Home of "The Keep"!

Member of:  "Association of Shareware Professionals"
Moderator for:  "The Delphi", "Delphi-DB", and "Delphi-Talk" programming
lists at elists.org,
and proud to be a donator to the Jedi VCL 3.0. 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Rob Kennedy
Sent: Wednesday, April 13, 2005 11:28 AM
To: Borland's Delphi Discussion List
Subject: Re: Oh boy...need pointer help...addendum!

Robert Meek wrote:
> As below:

Robert, this message was *very* difficult to follow, trying to 
distinguish your text from Jim's. Could you please configure your e-mail 
program to quote like normal e-mail programs?

-- 
Rob

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi


_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to