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

> Reply:  Perhaps I missed the call to use them directly 
> without conversion?

I'm lost, there's no conversion necessary for a constant of any type.  

   const CF_TEXT = 1;

What else can be said?



> Reply:  Yes, and I thought I DID understand it but when I attempted
> dereferencing the pointer I couldn't compile it! 

Ok, then, post the offending line or few.



> some thing!  I've never really used pointers except where 

So much has been said on this over the years, check the archives.  I'm sure
you can find simple explanations on the web.  But do it, a programmer has no
excuse not to understand pointers over strings or integers.  A pointer is
just another variable with its own special attributes like an integer that
holds different ranges of integer values depending on whether it's signed or
unsigned, or a string that has its length at a negative offset and can be
indexed by char.



> you, basically the area I was having problems with is this:
> 
>            DataBuffer := GlobalLock(Data);
>            try
>              DataSize := GlobalSize(Data);
>              OutFile.Write(DataSize, SizeOf(DataSize));
>              OutFile.Write(DataBuffer^, DataSize);
>            finally
>              GlobalUnlock(Data);
>            end;
>
> Also, exactly what is the purpose of the GlobalLock?  

Sounds like you're not reading the help on this stuff.  If you look at the
help on GlobalAlloc it becomes quickly clear.  Depending primarily upon
whether you allocate fixed or movable memory, the actual return from
GlobalAlloc is either a pointer to that memory or a handle to a memory
object.  That makes sense doesn't it?  If the memory is movable then if
windows hands you an actual pointer to the memory block and then moves it,
what becomes of your pointer?  Additionally, when you actually go to use the
memory block, doesn't it make sense that you might not want windows to move
it while you're trying to use it?  Thus, GlobalLock, whereby you tell
windows, lock this memory temporarily as I need access to it.  Thus, killing
two birds with the same stone, you tell windows you need to lock the movable
memory and in return it takes your object handle and returns to you a real
and valid pointer to the block in question.  When you're (temporarily) done,
you call GlobalUnlock so windows is free to move the block if necessary.

Either way, in the end, you get a pointer to the block of data.

As far as the block above, what's the problem? 




> Just for simplicity's sake I would probably like to store the 
> formats in a  separate field. 
> What type could I use to store them...as
> TStrings?  Is there anyway to make use of them without 
> converting them from their integer values first?  

Ok, I understand how you're seeing this but I wouldn't use the term
"converting" to describe this situation.  The registered formats aren't
"converted."  The registration process involves the registrant providing a
string name for the clipboard format and windows accepting this string name
and passing back an id for that name.  You really wouldn't say you're
converting from an HWND to a window string if by calling GetWindowText()
would you?  The integer format id isn't something you need to save, the
format names may be.


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

Reply via email to