Solved

ClipBoard & Stream

Posted on 1998-10-22
3
247 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 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

726 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