The SHCreateDirectoryEx function.
-
Hi guys, Here I am again... But now with another problem :p
SHCreateDirectoryEx(NULL, "c:\\text", NULL);
gives me the following error:1>d:\app2\app2\Form1.h(302) : error C2664: 'SHCreateDirectoryExW' : cannot convert parameter 2 from 'const char [8]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castI found that _T("..") should work; giving me the following error:
1>App2.obj : error LNK2028: unresolved token (0A000028) "extern "C" int __stdcall SHCreateDirectoryExW(struct HWND__ *,wchar_t const *,struct _SECURITY_ATTRIBUTES const *)" (?SHCreateDirectoryExW@@$$J212YGHPAUHWND__@@PB_WPBU_SECURITY_ATTRIBUTES@@@Z) referenced in function "private: void __clrcall App2::Form1::saveButton_Click(class System::Object ^,class System::EventArgs ^)" (?saveButton_Click@Form1@App2@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>App2.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall SHCreateDirectoryExW(struct HWND__ *,wchar_t const *,struct _SECURITY_ATTRIBUTES const *)" (?SHCreateDirectoryExW@@$$J212YGHPAUHWND__@@PB_WPBU_SECURITY_ATTRIBUTES@@@Z) referenced in function "private: void __clrcall App2::Form1::saveButton_Click(class System::Object ^,class System::EventArgs ^)" (?saveButton_Click@Form1@App2@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>D:\App2\Debug\App2.exe : fatal error LNK1120: 2 unresolved externalsDoes anyone have experience with this function. I want to make a (n absolute) folder and the OS where this will be written for is Vista (sorry - I might upgrade to W7 tho). Could someone give me some hints? Kind regards,
-
Hi guys, Here I am again... But now with another problem :p
SHCreateDirectoryEx(NULL, "c:\\text", NULL);
gives me the following error:1>d:\app2\app2\Form1.h(302) : error C2664: 'SHCreateDirectoryExW' : cannot convert parameter 2 from 'const char [8]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castI found that _T("..") should work; giving me the following error:
1>App2.obj : error LNK2028: unresolved token (0A000028) "extern "C" int __stdcall SHCreateDirectoryExW(struct HWND__ *,wchar_t const *,struct _SECURITY_ATTRIBUTES const *)" (?SHCreateDirectoryExW@@$$J212YGHPAUHWND__@@PB_WPBU_SECURITY_ATTRIBUTES@@@Z) referenced in function "private: void __clrcall App2::Form1::saveButton_Click(class System::Object ^,class System::EventArgs ^)" (?saveButton_Click@Form1@App2@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>App2.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall SHCreateDirectoryExW(struct HWND__ *,wchar_t const *,struct _SECURITY_ATTRIBUTES const *)" (?SHCreateDirectoryExW@@$$J212YGHPAUHWND__@@PB_WPBU_SECURITY_ATTRIBUTES@@@Z) referenced in function "private: void __clrcall App2::Form1::saveButton_Click(class System::Object ^,class System::EventArgs ^)" (?saveButton_Click@Form1@App2@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)
1>D:\App2\Debug\App2.exe : fatal error LNK1120: 2 unresolved externalsDoes anyone have experience with this function. I want to make a (n absolute) folder and the OS where this will be written for is Vista (sorry - I might upgrade to W7 tho). Could someone give me some hints? Kind regards,
Try referencing shell32.lib in Additional Dependencies option of the project Linker properties. If you're doing a C++/CLI application, you should be using
Directory::CreateDirectory
instead.«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
Try referencing shell32.lib in Additional Dependencies option of the project Linker properties. If you're doing a C++/CLI application, you should be using
Directory::CreateDirectory
instead.«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)I got an application. So called Windows Forms Application. I will try Directory::CreateDirectory. Thanks again. ---------- Edit: The IDE (Visual C++ Studio 2008 Express) cannot find
Directory::CreateDirectory
. I might to include some file I guess... ---------- Re-edit:CreateDirectory("c:\test", NULL);
works... Sort of - now I get the following error:1>d:\app2\app2\Form1.h(304) : error C2664: 'CreateDirectory' : cannot convert parameter 1 from 'const char [7]' to 'LPCTSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castmodified on Friday, November 13, 2009 1:06 PM
-
I got an application. So called Windows Forms Application. I will try Directory::CreateDirectory. Thanks again. ---------- Edit: The IDE (Visual C++ Studio 2008 Express) cannot find
Directory::CreateDirectory
. I might to include some file I guess... ---------- Re-edit:CreateDirectory("c:\test", NULL);
works... Sort of - now I get the following error:1>d:\app2\app2\Form1.h(304) : error C2664: 'CreateDirectory' : cannot convert parameter 1 from 'const char [7]' to 'LPCTSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castmodified on Friday, November 13, 2009 1:06 PM
You need to tell me if it is a managed or unmanaged application. Do you see
using namespace xxx
or#include xxx
on the top of the file? And what are they?«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
You need to tell me if it is a managed or unmanaged application. Do you see
using namespace xxx
or#include xxx
on the top of the file? And what are they?«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)Plentyyyyyy lol
#pragma once
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include "Serial/Serial.cpp" //http://www.codeproject.com/KB/system/serial.aspx
#include "shlobj.h"namespace App2 {
using namespace std;
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Runtime::InteropServices; -
I got an application. So called Windows Forms Application. I will try Directory::CreateDirectory. Thanks again. ---------- Edit: The IDE (Visual C++ Studio 2008 Express) cannot find
Directory::CreateDirectory
. I might to include some file I guess... ---------- Re-edit:CreateDirectory("c:\test", NULL);
works... Sort of - now I get the following error:1>d:\app2\app2\Form1.h(304) : error C2664: 'CreateDirectory' : cannot convert parameter 1 from 'const char [7]' to 'LPCTSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castmodified on Friday, November 13, 2009 1:06 PM
CreateDirectory(_T("c:\\test"), NULL);
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
CreateDirectory(_T("c:\\test"), NULL);
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)