有没有一个Api可使用?

解决方案 »

  1.   

    Paste Operations
    To retrieve paste information from the clipboard, a window first determines the clipboard format to retrieve. Typically, a window enumerates the available clipboard formats by using the EnumClipboardFormats function and uses the first format it recognizes. This method selects the best available format according to the priority set when the data was placed on the clipboard. Alternatively, a window can use the GetPriorityClipboardFormat function. This function identifies the best available clipboard format according to a specified priority. A window that recognizes only one clipboard format can simply determine whether that format is available by using the IsClipboardFormatAvailable function. After determining the clipboard format to use, a window calls the GetClipboardData function. This function returns the handle to a global memory object containing data in the specified format. A window can briefly lock the memory object in order to examine or copy the data. However, a window should not free the object or leave it locked for a long period of time. 
      

  2.   

    你剪贴板中的,是二进制的文件数据呢,还是像在windows资源管理器中复制了一个文件一样?
      

  3.   

    其实可以看成用Ctrl+C复制了一个文件,然后想根据一个指定的路径字符串将该复制的文件粘贴到该目录下
      

  4.   

    那其实就是像在windows资源管理器中复制了一个文件一样?
      

  5.   

    以下代码在指定目录中调用资源管理器的粘贴。相当于在该目录中点右键,选粘贴。IShellFolder* psfDesktop = NULL;
    HRESULT hResult = SHGetDesktopFolder( &psfDesktop );
    if( NOERROR != hResult )
    {
    return;
    }LPITEMIDLIST pidl = NULL;
    // 替换c:\\test为你的目录。输入必须为UNICODE字符串
    psfDesktop->ParseDisplayName( NULL, 0, L"c:\\test", NULL, &pidl, NULL );IShellFolder* psfFolder = NULL;
    HRESULT hResult = psfDesktop->BindToObject( pidl, NULL, IID_IShellFolder, ( void** )&psfFolder );
    if( hResult == S_OK )
    {
    IShellView* pView;
    if( S_OK == psfFolder->CreateViewObject( NULL, IID_IShellView, ( void** )&pView ) )
    {
    IContextMenu* pContextMenu;
    if( NOERROR == pView->GetItemObject( SVGIO_BACKGROUND, IID_IContextMenu, ( void** )&pContextMenu ) )
    {
    bResult = InvokeCommand( hWnd, pContextMenu, "paste" );   // use ANSI verb to paste items.
    pContextMenu->Release( );
    }
    pView->Release( );
    }
    }Malloc* pMalloc;
    if( SUCCEEDED( SHGetMalloc( &pMalloc ) ) )
    {
    pMalloc->Free( pidl );
    pMalloc->Release( );
    }psfFolder->Release( );
    psfDesktop->Release( );
      

  6.   

    InvokeCommand( hWnd, pContextMenu, "paste" )这一句应为:CMINVOKECOMMANDINFO cmi = { 0 };
    cmi.cbSize       = sizeof( CMINVOKECOMMANDINFO );
    cmi.lpVerb       = "paste";
    cmi.nShow        = SW_SHOWNORMAL;
    cmi.fMask        = 0U;
    cmi.hwnd         = hWnd;
    cmi.lpParameters = NULL;
    cmi.lpDirectory  = NULL;
    cmi.dwHotKey     = 0U;
    cmi.hIcon        = NULL;
    pContextMenu->InvokeCommand( &cmi );