1.比如在window某个目录下ctrl+c一个bmp/jpg文件,用98的剪贴板查看程序发现有一个文件绝对路径名
然后在delphi里用clipboard的formats[x]查看有个format就是filename,请问如何才能获得这个文件名?2.如果是在word/excel中选中一个图片后ctrl+c到剪贴板,如何才能获取到image里去?直接用image.picture.LoadFromClipboardFormat(CF_BITMAP...) 会显示unsupported clipborad format
 

解决方案 »

  1.   

    1.取文件名我不知道 2.可以这样子  if Clipboard.HasFormat(CF_BITMAP) then
      begin
        Image1.Picture.Assign(Clipboard)
      end;
      

  2.   

    >>1.比如在window某个目录下ctrl+c一个bmp/jpg文件,用98的剪贴板查看程序发现有一个文
    >>件绝对路径名        if clipboard.HasFormat(CF_BITMAP) then
              image1.Picture.Bitmap.LoadFromClipboardFormat
              (cf_BitMap, ClipBoard.GetAsHandle(cf_Bitmap), 0);
            //3.?理CF_HDROP格式?容
            if clipboard.HasFormat(CF_HDROP) then
            begin
              memo1.Lines.add('CF_HDROP{');
              drophandle := Clipboard.GetAsHandle(CF_HDROP);
              filescount := DragQueryFile(Drophandle, $FFFFFFFF,
                Filename, max_path); //?得文件拖放?目          for i := 0 to filescount - 1 do
              begin
                fillchar(filename, sizeof(filename), 0);
                if dragqueryfile(drophandle, i,
                  Filename, max_path) > 0 then
                  memo1.lines.add(strpas(@filename));
              end; //?取所有拖放文件的文件名          memo1.lines.Add('}');
            end;
      

  3.   

    >>2.如果是在word/excel中选中一个图片后ctrl+c到剪贴板,如何才能获取到image里去?        if clipboard.HasFormat(CF_BITMAP) then
              image1.Picture.Bitmap.LoadFromClipboardFormat
              (cf_BitMap, ClipBoard.GetAsHandle(cf_Bitmap), 0);