-
September 10th, 2004, 06:59 AM
#1
SHCreateDirectory not found
Hi,
I want to use SHCreateDirectory to create a directory, line C:\D1\D2\D3, etc. but I cannot find it. The compiler gives me the undeclared indentifier (C2065) error. According to MSDN:
Minimum DLL Version shell32.dll version 5.0 or later Custom Implementation No Header shlobj.h Import library shell32.lib Minimum operating systems Windows 2000
My shell32.dll version is 6.0.2800.1106, I am running on WinXP, with VisualC++ 6.0, SP6, and of course I include shlobj.h. But the funny thing is that there is no SHCreateDirectory in that header. I searched all the headers on my PC and there is not such method.
What is this?
-
September 10th, 2004, 07:03 AM
#2
Re: SHCreateDirectory not found
I think there isn't. Try SHCreateDirectoryEx
Har Har
-
September 10th, 2004, 07:03 AM
#3
Re: SHCreateDirectory not found
Download the latest Platfrom SDK from msdn.microsoft.com
-
September 10th, 2004, 07:27 AM
#4
Re: SHCreateDirectory not found
Originally Posted by PadexArt
I think there isn't. Try SHCreateDirectoryEx
So is the case of SHCreateDirectoryEx... What did you think?
I was hoping to avoid downloading from Microsoft after I saw yesterday "I, Robot".
-
September 10th, 2004, 07:30 AM
#5
Re: SHCreateDirectory not found
Originally Posted by cilu
So is the case of SHCreateDirectoryEx... What did you think?
True. I've just checked it and it is missing too. I've pointed it out as SHCreateDirectory doesn't even show up in MSDN Oct 2001.
Har Har
-
September 10th, 2004, 07:35 AM
#6
Re: SHCreateDirectory not found
Originally Posted by cilu
Then forward declare it and use LoadLibrary(...)/GetProcAddress(...)
-
September 10th, 2004, 07:43 AM
#7
Re: SHCreateDirectory not found
Originally Posted by Mick
Then forward declare it and use LoadLibrary(...)/GetProcAddress(...)
Well Mick, now you're coming with something... Thanks. I will do that.
-
September 10th, 2004, 08:12 AM
#8
still not working
I did this:
Code:
typedef int (WINAPI* lpfnSHCreateDirectory)( HWND hwnd, LPCWSTR pszPath );
void Tests()
{
HMODULE hShell32Dll = ::LoadLibrary( _T("shell32.dll") );
lpfnSHCreateDirectory lpFn = NULL;
if( hShell32Dll )
{
lpFn = (lpfnSHCreateDirectory)GetProcAddress( hShell32Dll, "SHCreateDirectory" );
if ( lpFn )
{
int ret = lpFn( NULL, (LPCWSTR)"C:\\D1\\D2\\D3");
switch(ret)
{
case ERROR_BAD_PATHNAME :
TRACE("The pszPath parameter was set to a relative path.\n");
break;
case ERROR_FILENAME_EXCED_RANGE :
TRACE("The path pointed to by pszPath is too long. \n");
break;
case ERROR_FILE_EXISTS :
TRACE("The directory exists. \n");
break;
case ERROR_ALREADY_EXISTS :
TRACE("The directory exists. \n");
break;
case ERROR_CANCELLED :
default:
TRACE("unknown\n");
break;
}
}
}
if( hShell32Dll != (HMODULE)INVALID_HANDLE_VALUE )
FreeLibrary(hShell32Dll);
}
But it gives me ERROR_BAD_PATHNAME, saying that "The pszPath parameter was set to a relative path". I also tried with a simple "C:\\D1" and it returning the same error... And I don't figure out why...
-
September 10th, 2004, 08:32 AM
#9
Re: SHCreateDirectory not found
(LPCWSTR)L"C:\\D1\\D2\\D3"
-
September 10th, 2004, 08:39 AM
#10
Re: SHCreateDirectory not found
Yeah... forgot about it... Thanks again, Mick.
-
July 17th, 2005, 11:14 AM
#11
Re: SHCreateDirectory not found
I had the same issue with ERROR_BAD_PATHNAME, and this thread fixed it, but I am curious... what does the L in the following line do? Why was it so important?
Code:
(LPCWSTR)L"C:\\D1\\D2\\D3"
-
July 17th, 2005, 11:22 AM
#12
Re: SHCreateDirectory not found
Originally Posted by esandegren
I had the same issue with ERROR_BAD_PATHNAME, and this thread fixed it, but I am curious... what does the L in the following line do? Why was it so important?
Code:
(LPCWSTR)L"C:\\D1\\D2\\D3"
that means that it will call the SHCreateDirectoryW api (the unicode one) and not the SHCreateDirectoryA (which is the ascii one)
Cheers
-
July 1st, 2022, 01:16 AM
#13
Re: SHCreateDirectory not found
Originally Posted by golanshahar
that means that it will call the SHCreateDirectoryW api (the unicode one) and not the SHCreateDirectoryA (which is the ascii one)
Cheers
Point of Order...
It's actually ANSI not ASCII. I know I'm late to this again.
-
July 1st, 2022, 03:10 AM
#14
Re: SHCreateDirectory not found
Originally Posted by TheMickSter
... I know I'm late to this again.
Exactly! About 17 years too late...
Victor Nijegorodov
-
July 17th, 2022, 05:26 PM
#15
Re: SHCreateDirectory not found
I am getting this error when I compile my code.
I had already included the function SHGetFolderPath
sucessfully, but when I added SHCreateDirectory(NULL, p_path)
it stopped compiling. I have the following headers
#include <windows.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include "Format.h"
#include <wchar.h>
#include <stdio.h>
#include <shlwapi.h> // for SHGetFolderPath function
#include <shlobj.h> // for SHGetFolderPath and SHCreateDirectory function
//*************************************************************************************************************************
#pragma comment(lib, "shlwapi")
#pragma comment(lib, "shell32")
Any suggestions?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|