Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (EternallyCurious, howardR), 646 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[SOLVED] Using the SHCreateDirectoryExA function #481192
08/12/20 13:33
08/12/20 13:33
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 993
Budapest
Hi All!

I tried to use this function: SHCreateDirectoryExA
I can't call it to life. Here is how I tried to do:
Code
int WINAPI SHCreateDirectoryEx(HWND hwnd, LPCSTR pszPath, void* psa);
#define PRAGMA_API SHCreateDirectoryEx;Shell32.dll!SHCreateDirectoryExA
SHCreateDirectoryEx(NULL, _chr(pif), NULL);

I got a crash for the third line: "Script crash in main"

I included the following headers:
Code
#include <acknex.h>
#include <strio.c>
#include <windows.h>
#include <stdio.h>

What should be the correct way of the usage of this function?

Last edited by Aku_Aku; 08/13/20 18:42.
Re: Using the SHCreateDirectoryExA function [Re: Aku_Aku] #481201
08/12/20 21:46
08/12/20 21:46
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Hi,it works here. I am not getting any errors.

Code
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <windows.h>
///////////////////////////////

int WINAPI SHCreateDirectoryEx(HWND hwnd, LPCSTR pszPath, void* psa);
#define PRAGMA_API SHCreateDirectoryEx;Shell32.dll!SHCreateDirectoryExA

STRING* pif="c:\\xx";
function main()
{
	SHCreateDirectoryEx(NULL, _chr(pif), NULL);

	//verification
	if(GetFileAttributes(_chr(pif))!=0xFFFFFFFF)
	{
		printf("Done!");
	}
}

Re: Using the SHCreateDirectoryExA function [Re: Aku_Aku] #481213
08/13/20 14:32
08/13/20 14:32
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 993
Budapest
Interesting... I going to try it again, maybe I did something wrong.
Thanks.

Edit:
OK, I've catched the reason. The function declaration was in the main at my side.
After I moved that out of the main, it suddenly began to work. Now it is OK.
Thanks again Emre.

Last edited by Aku_Aku; 08/13/20 18:41.
Re: Using the SHCreateDirectoryExA function [Re: Aku_Aku] #481215
08/13/20 16:23
08/13/20 16:23
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
Brackets seem to help when I am programming. I know there are situations where you don't technically need them, but I tend to stay safe and use them all the time.

Re: Using the SHCreateDirectoryExA function [Re: Emre] #481220
08/13/20 18:30
08/13/20 18:30
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 993
Budapest
@Emre: Strange... Doesn't work for me... I have got the message: Script crashes in main.
I am investigating more on that.
It is OK now, as I explained in my edited previous post.

Last edited by Aku_Aku; 08/13/20 18:43.
Re: Using the SHCreateDirectoryExA function [Re: Dooley] #481221
08/13/20 18:31
08/13/20 18:31
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 993
Budapest
Which brackets did you mean?


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1