Solved

ClipBoard & Stream

Posted on 1998-10-22
3
237 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now