Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. About Get Data from Clipboard

About Get Data from Clipboard

Scheduled Pinned Locked Moved .NET (Core and Framework)
cssgraphicsdebuggingquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RafMar
    wrote on last edited by
    #1

    I know that I have Data in the clipboard with the DataFormat.MetafilePict. But I can't get it. My code is more or less the next: ///////////////////////////////////////////////////////////// IDataObject iData = Clipboard.GetDataObject(); if ( iData.GetDataPresent( DataFormats.MetafilePict) ) { System.Object obj; System.Drawing.Imaging.Metafile pMetafile; obj = Clipboard.GetDataObject()>GetData(System.Windows.Forms.DataFormats.MetafilePict ); } ///////////////////////////////////////////////////////// Obviusly in the Debug, I enter inside the first if condition, so the code executes but the System::Object obj can't keep the data of clipboard and keeps a undefined value after the asignation. It seems a contradiction, isn't it ? :confused: Can anybody say me anything about get MetafilePict Data from Clipboard ? Advanced Thanks, everybody.;)

    J 1 Reply Last reply
    0
    • R RafMar

      I know that I have Data in the clipboard with the DataFormat.MetafilePict. But I can't get it. My code is more or less the next: ///////////////////////////////////////////////////////////// IDataObject iData = Clipboard.GetDataObject(); if ( iData.GetDataPresent( DataFormats.MetafilePict) ) { System.Object obj; System.Drawing.Imaging.Metafile pMetafile; obj = Clipboard.GetDataObject()>GetData(System.Windows.Forms.DataFormats.MetafilePict ); } ///////////////////////////////////////////////////////// Obviusly in the Debug, I enter inside the first if condition, so the code executes but the System::Object obj can't keep the data of clipboard and keeps a undefined value after the asignation. It seems a contradiction, isn't it ? :confused: Can anybody say me anything about get MetafilePict Data from Clipboard ? Advanced Thanks, everybody.;)

      J Offline
      J Offline
      John Arlen
      wrote on last edited by
      #2

      (Not saying this is your problem, but...) As written, the code you supplied will not work as you expect. You declare "System.Object obj;" inside the if() statement. Therefore as soon as you exit the block (next line) - obj is no longer a valid object. To correct this (if it isn't just a typo in your sample), move the System.Object obj; declaration before the if( Data.Get....) statement.

      R 1 Reply Last reply
      0
      • J John Arlen

        (Not saying this is your problem, but...) As written, the code you supplied will not work as you expect. You declare "System.Object obj;" inside the if() statement. Therefore as soon as you exit the block (next line) - obj is no longer a valid object. To correct this (if it isn't just a typo in your sample), move the System.Object obj; declaration before the if( Data.Get....) statement.

        R Offline
        R Offline
        RafMar
        wrote on last edited by
        #3

        OK, thanks for reply, there was only an exemple. You are right, but if you proove the code with the correct order ( as you very well are saying ), you will see that doesn't work well ( The object 'obj' doesn't keep the data..). I have read in Microsoft support that there is a debug in this cases that imposibility the correct retriving some kind of Data from Clipboard, as Metafiles ( I hope that the next version of .NET will correct this cuestion.) Thank you very much Arlen :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups