Make a hidden directory???
BlitzPlus Forums/BlitzPlus Programming/Make a hidden directory???| 
 | ||
| Is there a way to make Account Files hidden? 
CreateDir C:/Program Files/Admin-Z/Missions/
CreateDir C:/Program Files/Admin-Z/Account Files/
fileout = WriteFile("../Account Files/account.dat")
WriteLine(fileout,agentID)
WriteLine(fileout,agentTERMINAL)
WriteLine(fileout,agentPASS)
CloseFile fileout
 | 
| 
 | ||
| You can hide the file itself:- 
//Creates a hidden file, which is handy for config settings etc etc
// E.g.		result = CreateHiddenFile(fileName$)
BBDECL BOOL BBCALL CreateHiddenFile( const char * fileName)
{
	HANDLE hFile; 
	//Check to see if file exists
	hFile = CreateFile(fileName,       
                GENERIC_WRITE,              
                0,           
                NULL,                     
                OPEN_EXISTING,           
                FILE_ATTRIBUTE_HIDDEN,    
                NULL);   
 
	//If not, create a new one
if (hFile == INVALID_HANDLE_VALUE) 
{ 
	hFile = CreateFile(fileName,   
             GENERIC_WRITE,   
             0,         
             NULL,      
             CREATE_ALWAYS,      
             FILE_ATTRIBUTE_HIDDEN,   
             NULL);  
	if (hFile == INVALID_HANDLE_VALUE) 
	{ 
        return(FALSE); 
	} 
}
		
		CloseHandle(hFile);
	return(TRUE);
}
//DECLS:-
//CreateHiddenFile%(filename$):"_CreateHiddenFile@4"
This is a userlib BTW... I know you can get a handle to a directory using CreateFile, so it may be possible to create one with the FILE_ATTRIBUTE_HIDDEN flag just by passing the new folders path$... But dont quote me on that! :D If not, just plonk the hidden files in your config folder or something, I mean, nobody is going to see them anyway are they! ;) Dabz | 
| 
 | ||
| Okay thats great only I don't think it is in blitzplus.... | 
| 
 | ||
| Give me a second and I'll compile it for you. | 
| 
 | ||
| Here. Get it soon cause I'm taking it down tonight. Oh, yeah just copy those files to C:\Program Files\BlitzPlus\userlibs\ (assuming you installed BlitzPlus to the program files.) And if you distribute your game/app make sure you put HiddenFile.dll in the same directory as your game/app exe. | 
| 
 | ||
| Alright I got it what do I open it with? I have blitzplus blitz3d and a demo if blitzmax | 
| 
 | ||
| CreateHiddenFile is now a command you can use. | 
| 
 | ||
| Oh sweet. What dir do I save it as? userlib or something... | 
| 
 | ||
| yep, stick those files in the userlib folder in your BlitzPlus installtion folder. | 
| 
 | ||
| Ok then I can make my thing like this: 
createhiddenfile("../Account Files/account.txt")
fileout = writefile("../Account Files/account.txt")
WriteLine(fileout,agentID)
WriteLine(fileout,agentTERMINAL)
WriteLine(fileout,agentPASS)
CloseFile fileout
right... | 
| 
 | ||
| Yes, it should work like that but I haven't tested it. | 
| 
 | ||
| It would be better if I could just make Account Files hidden... | 
| 
 | ||
| To be honest arget, I'd imagine you'll have a config folder or something similar, just your account files in there... Its not like people are going to see them is it! :D I havent used this for ages because now I do stuff in Max, but try:- 
createhiddenfile("../Account Files/")
createhiddenfile("../Account Files/account.txt")
I know you can get a handle for folders using the Win32's CreateFile, so you may be able to create them too with the hidden attribute. Dabz |