• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 900
  • Last Modified:

PowerBuilder 10 and GetVolumeInformation

PowerBuilder 10 on Windows XP:  I need to check whether a CD drive has a disk in it.  I found older articles about GetVolumeInformation but it appears this is not supported in PB10.  Can this be done in PB10?  What would the code look like?  TIA!
0
SRO_TSG
Asked:
SRO_TSG
  • 2
1 Solution
 
jkrCommented:
'GetVolumeInformation()' (http://msdn2.microsoft.com/en-us/library/aa364993.aspx) is a Win32 API, so that should definitely be supported. Alternatively, you can use 'CreateFile()' for5 that purpose, i.e.

HANDLE hDisk = CreateFile("\\\\.\\X:", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);

If (INVALID_HANDLE_VALUE == hDisk) {

  // no disk

} else {

  CloseHandle(hDisk);
}
0
 
jkrCommented:
I forgot - 'X:' in the above should of course be your CD drive's letter.
0
 
diasroshanCommented:
Hi,

I dont know how far this workaround will succeed, but give it a try,

have a listbox control on ur window and the code is below,

Boolean lb_valid
lb_valid = lb_1.DirList("Z:\*.*", 0)

If lb_valid = False Then
      MessageBox('Warning','No Disc in drive or Disc Unreadable!',Information!)
End If


Cheers,
Rosh

0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now