J'ai une application Win32 API dans Visual C++. Je veux créer un répertoire dans Application Common Data Directory. J'ai le code qui génère l'erreur suivante. J'ai également essayé d'ajouter '\ 0' à la fin de la chaîne, mais la même erreur apparaît.Création d'un répertoire dans Application Common Data Directory
Échec de l'assertion de débogage! Expression: (L "Chaîne n'est pas terminée par NULL" & & 0);
code:
TCHAR AppDir [MAX_PATH]; TCHAR SetPath [MAX_PATH];
ITEMIDLIST * pidl; HRESULT hRes = SHGetSpecialFolderLocation (NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, & pidl); if (hRes == NOERROR) { SHGetPathFromIDList (pidl, AppDir); }
strcpy_s (SetPath, AppDir);
:: strcat_s (SetPath, "\ Keylogger"); :: SHCreateDirectoryExW (hWnd, (LPCWSTR) SetPath, NULL);
:: strcat_s (SetPath, "\ SnapShot"); :: SHCreateDirectoryExW (hWnd, (LPCWSTR) SetPath, NULL);
Merci pour votre précieux commentaire. –