?
Solved

ClipBoard & Stream

Posted on 1998-10-22
3
Medium Priority
?
252 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 200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month17 days, 11 hours left to enroll

829 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