Replace MakeSureDirectoryPathExists_() in UNICODE [Resolved]

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Replace MakeSureDirectoryPathExists_() in UNICODE [Resolved]

Post by Kwai chang caine »

Hello at all

I was sure the passage to UNICODE make with me, numerous problem :|
For the master, never problem, just adding a letter, a little thing, etc..
For KCC, even when he search a long time, and try several way, that not works :oops:

So since several years i use this splendid API MakeSureDirectoryPathExists_(), simple, all in a line, so the better for me
And this morning i see my code not works :shock:
After search i found it's MakeSureDirectoryPathExists_() and see it not works in UNICODE
It replaced by SHCreateDirectoryEx()
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

Obviously, this one is not recognize by PB (in other case it's not funny) :?
So KCC try to play, like a big, with the tools of MASTERS .....import function...and that not works :oops:

They are example in VB

Code: Select all

Private Declare Function SHCreateDirectoryEx Lib "Shell32.dll" Alias "SHCreateDirectoryExA" _(ByVal hwnd As Long, ByVal pszPath As String, ByVal lngsec As Long) As Long

SHCreateDirectoryEx 0&,  "D:\Kcc\",  0&
I have try

Code: Select all

Import "shell32.lib"
  SHCreateDirectoryEx(hwndWindow.l, Path.s, pszPath.l)
EndImport

Debug SHCreateDirectoryEx(0, "D:\Kcc\", 0)

Code: Select all

Import "shell32.lib"
  SHCreateDirectoryEx(hwndWindow.l, Path.s, *pszPath)
EndImport

Debug SHCreateDirectoryEx(0, "D:\Kcc\", 0)

Code: Select all

Import "shell32.lib"
  SHCreateDirectoryExA(hwndWindow.l, Path.s, pszPath.l)
EndImport

Debug SHCreateDirectoryExA(0, "D:\Kcc\", 0)
I have no new idea ..
If someone know how call this API

Have a good day
Last edited by Kwai chang caine on Tue Sep 27, 2016 3:45 pm, edited 1 time in total.
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Replace MakeSureDirectoryPathExists_() in UNICODE

Post by Kwai chang caine »

Incredible ... :D justly in the same moment you write to me i visit your splendid archive site 8)
For search the link broken http://www.filedropper.com/interfacingwithcdlls of TONI6
http://www.purebasic.fr/english/viewtop ... 10#p406910
But unfortunately, you have not can save it :(
Never mind, ....your site, is always very usefull 8)

Thanks for this two links, but i search mainly to use this API
I have already some codes for create a full path, if necessary
But have just one line for do the job...i found that giant :wink:

I have found several thread who talk to this subject, but no example :|
Have a good day
ImageThe happiness is a road...
Not a destination
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Replace MakeSureDirectoryPathExists_() in UNICODE

Post by Marc56us »

one line for do the job

Code: Select all

RunProgram("cmd", "/c md " + "C:\AAA\BBB\CCC\", "", #PB_Program_Hide | #PB_Program_Wait)
(a lite version of ts-soft code)
http://www.purebasic.fr/german/viewtopi ... =8&t=27633

Yes, 'md' now auto change disk drive and remove \
(the old ms-dos command 'md' did not change disk and drive in the same action, but CMD does)

:wink:
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Replace MakeSureDirectoryPathExists_() in UNICODE

Post by Shardik »

You may use

Code: Select all

Debug SHCreateDirectory_(0, "C:\Temp\Kcc")
which is working for me in Windows XP SP3 and Windows 8.1 x64 with PB 5.43 in Unicode mode and in PB 5.50 (of course you need a folder C:\Temp and write access for this folder)... :wink:
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Replace MakeSureDirectoryPathExists_() in UNICODE

Post by Kwai chang caine »

@Marc56Us
:lol: You play with the words :lol:
So thanks for the idea :wink:

@Shardik
Yeeeeessss !!!
You are my saver 8)
That's works here too in W7 X86
Image
Thanks a lot for your precious help

Ps = i love your bear :lol:

@All
I wish to you all a very good day
ImageThe happiness is a road...
Not a destination
Post Reply