IFileOperation 32bit,在64bit上不起作用 [英] IFileOperation 32bit, doesn't work on 64bit

查看:89
本文介绍了IFileOperation 32bit,在64bit上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在32位机器上构建它并且在32位机器上工作得非常好但是当我在64位机器上试用它时它不起作用



Hi, i have build this in 32 bit machine and it works perfectly fine in 32 bit machine but when i tried it on a 64 bit machine it doesn't work

void _CopyItem(LPCWSTR src, PCWSTR dest, PCWSTR newname)
{
    IFileOperation *pfo;
    IShellItem *psiTo = NULL;
    IShellItem *psiFrom = NULL;

    CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
    {
        if(S_OK == CoCreateInstance(CLSID_FileOperation,
            NULL,
            CLSCTX_ALL,
            IID_PPV_ARGS(&pfo)))
        {
            pfo->SetOperationFlags(FOF_NOCONFIRMATION
                | FOF_SILENT
                | FOFX_SHOWELEVATIONPROMPT
                | FOFX_NOCOPYHOOKS
                | FOFX_REQUIREELEVATION
                | FOF_NOERRORUI);
            {

                if(S_OK == SHCreateItemFromParsingName(src,
                    NULL,
                    IID_PPV_ARGS(&psiFrom)))
                {

                    if(NULL != &psiFrom)
                    {
                        if(S_OK == SHCreateItemFromParsingName(dest,
                            NULL,
                            IID_PPV_ARGS(&psiTo)))
                        {
                            CopyItem(psiFrom, psiTo, newname, NULL);
                            if(NULL != psiTo)
                                psiTo->Release();
                        }
                    }
                    psiFrom->Release();
                }
                pfo->PerformOperations();
            }
            pfo->Release();
        }
        CoUninitialize();
    }

}





i有一种感觉,如果我在64位机器上编译它会在64位工作,不能在32位机器上工作,我使用VS2008

任何想法为什么这不能正常工作?



编辑*它doenst'复制我想要的文件



i have a feeling if i compiled it on 64 bit machine it will work on 64 bit and will not work on 32 bit machine, im using VS2008
any ideas why this isn't working well ?

EDIT* it doenst' copy the file that i want

推荐答案

这看起来像在IFileOperation :: CopyItem帮助页面上找到的相同/类似的代码(其中 [ ^ ])但有些返回代码检查已删除。这看起来像一个直截了当的问题。首先,您应该查看每个返回代码并采取相应措施。其次,只需在调试器中运行此代码并逐步执行每个语句。查看每个语句执行时的返回码和结果。这不是一个复杂的问题。
This looks like the same/similar code found at the IFileOperation::CopyItem help page (here[^]) but with some of the return code checking removed. This looks like a straightforward problem. First, you should look at each return code and act accordingly. Second, just run this code in the debugger and step through each statement. Look at the return code and results of each statement as it executes. This is not a complicated problem.


这篇关于IFileOperation 32bit,在64bit上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆