?
Solved

ClipBoard & Stream

Posted on 1998-10-22
3
Medium Priority
?
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month8 days, 19 hours left to enroll

765 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