[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to read Byte by Byte From Clipboard Image data?

Posted on 1998-05-09
4
Medium Priority
?
991 Views
Last Modified: 2008-02-01
Hi experts,
I have stored an image in clipboard.  Now i want to read the image byte by byte so that i can break it into pieces and send it over the tcp/ip based network to another station, where this station will re-assamble the data and display it in its image box or picture box.

Thanks in advance
0
Comment
Question by:msali
[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
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 200 total points
ID: 1444729
Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, source As Any, ByVal numBytes As Long)

Dim bytPic() As Byte

Private Sub Form_Load()
    Dim lSize  As Long
    Dim picCur As Variant
   
    Clipboard.Clear ' Clear Clipboard.
    Clipboard.SetData LoadPicture("c:\windows\FOREST.BMP")
    picCur = Clipboard.GetData(vbCFBitmap)
   
    lSize = FileLen("c:\windows\forest.bmp")
    ReDim Preserve bytPic(0 To lSize - 1) As Byte
   
    Call CopyMemory(ByVal VarPtr(bytPic(0)), ByVal VarPtr(picCur), lSize)
   
End Sub

0
 

Author Comment

by:msali
ID: 1444730
Thanks for the example but in this case u are reading the filesize from the disk.  In my project i have captured the image using bitblt and do not want to save it since saving the file i.e., disk I/O is slow.  I will be capturing the image in a timer event so lots of images in maybe 5-10 to 15 seconds of time.

waiting for a reply.
thanks a mil
regards,
msa.
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1444731
Then calculate the size as you capture it!?
0
 

Author Comment

by:msali
ID: 1444732
Dear anthonyc,
This is exactly the problem i am facing.  I do not know how to address the memory (DC).  That is why i tried to place the img in the clipboard - assuming i might be able to access the clipboard memory.  Listed below is the code of my cliping the image:

Sub CopyScreen(canvas As Object)
    Dim screendc&
   
    canvas.AutoRedraw = True
    screendc = CreateDC("DISPLAY", "", "", 0&)
    tempLong = StretchBlt(canvas.hdc, 0, 0, Screen.Width, Screen.Height, screendc, 0, 0, Screen.Width, Screen.Height, SRCCOPY)
    tempLong = DeleteDC(screendc)
    canvas.AutoRedraw = False
   
End Sub

Private Sub Timer1_Timer()
    CopyScreen Me
    Me.Caption = "Icu Uc Me - " & Counter
    Counter = Counter + 1
End Sub

regards,
msa.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

656 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