Solved

ClipBoard & Stream

Posted on 1998-10-22
3
241 Views
Last Modified: 2010-04-06
I try to use this:
  Buffer:=GetAsHandle(cf_privatefirst);
  BufferPtr:=GlobalLock(Buffer);
  Stream.Write(BufferPtr^,SizeOf(PSM));
In the case that stream contains only one PSM it works. If the Stream contains more PSM i don't know how can I get the count parameter of write! Of course I know how often I wrote but using the clipboard I can not use it!
0
Comment
Question by:Saxon
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 50 total points
ID: 1344078
You can do this in two ways:

1. Determine how big the global block is (using GlobalSize(Buffer)) and determining how many PSM's fit into it

2. When you write that data into the clipboard, first write out the number of PSMs to follow, followed by the PSMs. When you read it in first read the number followed by that many PSMs.

Cheers,

Raymond.
0
 

Author Comment

by:Saxon
ID: 1344079
In principle it works. Thx! But why I get a bigger (4672 instead of 4668) size value. The win api help tells me, that the size may be larger. If the additional bytes added at the end it shouldn't be a problem. But can I be sure for that?
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1344080
Global blocks (using GlobalAlloc at least) are guaranteed to be aligned on an 8 bytes boundary. The API proabaly just adds the slack to the allocated area to make it easier to track it. I think you are safe assuming that the extra is always at the end.

Cheers,

Raymond
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
my delphi exe application have  problem with windows explorer ! 12 84
Delphi 2 59
tidtcpserver connection lost handle 2 83
Twebbrowser add css to the header 3 25
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question