使用CSIDL_BITBUCKET获取回收站文件夹会导致字符串乱码

时间:2017-10-17 02:35:00

标签: c++builder

我的环境

C++ Builder XE4 on Windows 7 Pro (32bit)

我正在尝试获取"回收站"使用CSIDL_XXX

Unit2.cpp

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::B_checkRecycleBinClick(TObject *Sender)
{
    //LPTSTR getPath[255];
    wchar_t appdata[255];
    SHGetSpecialFolderPath(NULL, appdata, CSIDL_APPDATA, false);
    OutputDebugString(appdata);

    wchar_t recycle[255];
    SHGetSpecialFolderPath(NULL, recycle, CSIDL_BITBUCKET, false);
    OutputDebugString(recycle);
}
//---------------------------------------------------------------------------

使用上面的代码,

  • 我可以获得APPDATA路径
  • 回收路径乱码

Q值。你能辨认出什么错误?

0 个答案:

没有答案