Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8283377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:42:55+00:00 2026-06-08T10:42:55+00:00

I am trying to fetch a Device Independent Bitmap from the clipboard. I am

  • 0

I am trying to fetch a Device Independent Bitmap from the clipboard. I am well-aware that this can be done through the Clipboard.GetData function inbuilt in the .NET Framework, but since it is very buggy (as documented many places on the web), I want to use the APIs only.

I have written the following code which works.

//i can correctly cast this to a MemoryStream
MemoryStream ms = Clipboard.GetData("DeviceIndependentBitmap") as MemoryStream;

But I want to use it with the APIs, which just return a pointer (an IntPtr) that point to the stream somehow. I took a look at the UnmanagedMemoryStream but fail to understand how to correctly convert an IntPtr into that.

Here’s my API code (using the GetClipboardData API where the CF_DIB format is set as its argument).

IntPtr p = GetClipboardData(8);
//what do I do from here to get a MemoryStream from this pointer?

I’m a bit confused. I already researched it myself, but couldn’t come up with something useful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:42:56+00:00Added an answer on June 8, 2026 at 10:42 am

    As you said you can use UnmanagedMemoryStream(byte* pointer, long length) and to use it you should have a pointer and the length of the bytes. So you can use IntPtr.ToPointer() method to get the pointer, but you should know the length of the memory content.

    UnmanagedMemoryStream unmanagedmemstream = UnmanagedMemoryStream(p.ToPointer(), 100);
    

    There is another method to retrieve an array of bytes, but also here you should know the length of the memory bytes that you want and it is Marshal.Copy(IntPtr source, byte[] destination, int startIndex,int length):

    byte[] buffer = new byte[100];
    Marshal.Copy(p , buffer, 0, buffer.Length);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to fetch data from a page that resides on an intranet. The
If I'm trying to fetch this only within view. How can I? controller @last_comment
I'm trying to fetch this page (it's in Chinese, sorry for that): amazon(dot)cn/s?rh=n:663227051 using
I am trying to fetch data from my .net project on my android device.
I am trying to fetch a gzip from a URL and import it automatically
I am trying to fetch wcf service from jquery. I have written below code
I'm trying to fetch some JSON data from my server like so: var a
I'm trying to fetch and parse an XML-file through JavaScript. I don't control the
I'm trying to fetch some settings from my membership provider in my asp.net application
I'm trying to fetch data from a div (based on his id), using PHP's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.