XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 8th, 2025, 9:12 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: April 28th, 2013, 6:17 am 
Offline

Joined: April 13th, 2013, 12:39 pm
Posts: 7
functions FolderExists() and FileExists() causes an error "Insert disk in drive X:", when check an empty dvdrom. I don't know, is this a bug, but it causes problems
I've tried to use DiskIsReady("") function, but I didn't understand, how to use it.


Top
 Profile  
 
PostPosted: April 28th, 2013, 5:27 pm 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
This isn't a bug. That's standard windows practice. If some drive is not ready, no API operation is allowed on it.

Code:
if(DiskReady("DRIVE:"))
{
//some  stuff
}
else {
//disk not ready
}


For more control, you can use file system object. See MSDN for more details

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
PostPosted: April 29th, 2013, 10:10 pm 
Offline

Joined: April 13th, 2013, 12:39 pm
Posts: 7
When I use DiskIsReady("Drive:") function, it cause an error "Runtime error: the existence of an object is expected" (Translated from Russian)


Top
 Profile  
 
PostPosted: April 30th, 2013, 3:08 am 
Offline
User avatar

Joined: May 12th, 2012, 8:32 pm
Posts: 594
Hi, you can uses the DiskCore, and set disk name with
Code:
diskcore1.cmd(null, "diskname=c");


Code:
  if(diskcore1.IsBlank)
  {
      //the disk is blank or not exists
  }
  else
  {
  }





Code:
if(diskcore1.DiskType<2)
{
  alert("disk not exit");
}




Or, you can use ActiveX object "FSO" function "DriverExists" and get the disk type

Code:
var fso = new ActiveXObject("Scripting.FileSystemObject");
if( ! fso.DriveExists("d") )
  alert("Dirver D is not Exists");


_________________
XWidget Software Developer
[XWidget for Android] [Lastest version of XWidget] [Lastest patch of XWidget]
[XDesktop for Android/Windows]


Top
 Profile  
 
PostPosted: April 30th, 2013, 8:56 pm 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
stormitornado wrote:
When I use DiskIsReady("Drive:") function, it cause an error "Runtime error: the existence of an object is expected" (Translated from Russian)


Ok... As I expected..
then this is what you need
http://msdn.microsoft.com/en-us/library/x681abd9(v=vs.84).aspx

Code:
var fso = new ActiveXObject("Scripting.FileSystemObject");
var disk = fso.GetDrive("J:"); //change with your drive

if(disk.IsReady)
{
//disk is ready and contains media
}
else {
//disk not ready...
}


I don't know why but I too faced problems with XWidget built-in DiskIsReady(). This is a bug... needs to be fixed. Meanwhile ActiveX is the only workaround.

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: Google [Bot] and 41 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group