Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Desktop, Mobile and non-browser Environments > Projectors and CDs

Reply
 
Thread Tools Rate Thread Display Modes
Old 01-14-2005, 04:22 PM   #1
mazeroth
Registered User
 
Join Date: Jan 2005
Posts: 6
Default Check for free hard drive space

Hello all, hope you guys can help. I'm working on a Desktop application written in flash mx using screenweaver that at the beginning copys files from a CD-ROM to the local hard drive. The problem is, I can't seem to find a way to find how much free hard drive space the user has before trying to copy files. Does anyone know of a way to look this information up before trying to copy files.
mazeroth is offline   Reply With Quote
Old 01-14-2005, 05:00 PM   #2
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,878
Default

Howdy and Welcome...

Screenweaver, eh??? I have not personally used that one before, and not many people in this forum, that I know of, do not use it either... So, I guess this is not the perfect place to ask Screenweaver questions... But then, Screenweaver support team is long gone...

I have browse through the online Screenweaver user guide and I was not able to find anything useful... But I use Flash Studio Pro and it has builtin function that does the job... (flashstudio.getfreespace) So, if that's your option, you can go that route... Or, if that's not, you can build your own EXE file in C++(or whatever else that you can program) and get the value out of it...

That's all I can think of...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 01-14-2005, 06:27 PM   #3
mazeroth
Registered User
 
Join Date: Jan 2005
Posts: 6
Default

Thanks, I'm currently looking into using the kernel32.dll and calling the getdrivespace function to get the information I need that way. I've also been unable to find anything useful to get this information through screenweaver other then calling an external dll. Hopefully this will work because this whole application was built around screenweaver and it's too late to change it now.
mazeroth is offline   Reply With Quote
Old 01-14-2005, 06:39 PM   #4
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,878
Default

Hm... That's very interesting approach... Please let us know how you do that when you get that solved...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 01-18-2005, 06:49 PM   #5
mazeroth
Registered User
 
Join Date: Jan 2005
Posts: 6
Default

So here is where I am right now. I'm successfully calling the "GetDiskFreeSpaceEx" function from the kernel32.dll, here's what that function looks like:

BOOL GetDiskFreeSpaceEx(
LPCTSTR lpDirectoryName,
PULARGE_INTEGER lpFreeBytesAvailable,
PULARGE_INTEGER lpTotalNumberOfBytes,
PULARGE_INTEGER lpTotalNumberOfFreeBytes
);

http://msdn.microsoft.com/library/de...reespaceex.asp

It expects a drive letter in, and returns 3 variables back. All 4 have to be set before calling the dll. Now the problem I'm having is declaring the 3 int ptrs in flash before calling the dll so it returns the correct information. I have to declare 3 64 bit ints before calling the dll but there's no way in flash to just declare a var as a 64 bit int. I don't think the vars are being set large enough to get all the data back correctly.

Here's the flash/sreenweaver code:

args = {
ptr_lpTotalNumberOfFreeBytes: 0,
ptr_lpTotalNumberOfBytes: 0,
ptr_lpFreeBytesAvailableToCaller: 0,
lpRootPathName: "C:\\"
}
swInterface.callDllMethod( "C:\\WINNT\\SYSTEM32\\kernel32.dll", "GetDiskFreeSpaceExA", args, this.space_callback );

function space_callback( code, msg, args ){
swDebug.trace( "Code: "+code+" Msg: "+msg );
swDebug.traceObject( args );
free_txt.text= args.lpTotalNumberOfBytes;

}

The args are passed backwards because in screenweaver if you declare the Object the way I did then you have you pass them backwards. Anyways, I'm getting 8.96785185568511e-308 for args.lpTotalNumberOfBytes everytime. It's a 68.3 gig drive so I don't know what that number means.

I guess I'm posting this to see if anyone has any experience interacting with dll's whether it's through screenweaver or other tools and if you have had issues declaring ptrs to make the process work correctly? I'm real close to getting this to work. Thanks.

PS: Sucks that something I thought would be so simple is taking so long to do.
mazeroth is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:49 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.