Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Detecting CDROM and other related questions...


1 reply to this topic

gronchi

gronchi
  • Members
  • 71 posts

Posted 21 November 2002 - 18:09

Hi to all,

1) How to detect if a CDRom is inserted into the CDRom drive?
Using:
Code Sample

GetSystemInfo (CDROM, bisCDRomInserted, svResult);
if( bisCDRomInserted = FALSE) then
  SprintfBox (WARNING, "CDRom warning", "CDRom drive empty! Insert CDRom and press OK");
endif;

It seems to detect the CDRom drive presence, NOT the CDRom presence.
Nevertheless the Help says:
Code Sample

GetSystemInfo (nItem, nvResult, svResult);
nItem: CDROM
nvResult: TRUE or FALSE Indicates whether a CD ROM is available.
svResult: N/A


2) In PC with more than one CDRom drive how is the simplest way to detect CDRom drive letter with inserted a CDRom (if one)?

2.1) This is my workaround to 2) problem:
Code Sample

// Create a list to hold the CDRom drive names.
lCDRom = ListCreate(STRINGLIST);
// Get CDRom drives.
if (GetValidDrivesList (lCDRom, CDROM_DRIVE, -1) < 0) then
  SprintfBox (SEVERE, "CDRom Error", "Unable to detect CDRom drive!");
else
  nCDRomDrive = ListCount (lCDRom);
  if (nCDRomDrive <= 0) then
     SprintfBox (SEVERE, "CDRom Error", "Unable to detect CDRom drive!");
  elseif (nCDRomDrive > 1) then
     SdShowInfoList ("CDRom Warning", "This PC have more CDRom drivers!", lCDRom);

        // Help me to do this:
        // put list's item into a dialog box (i.e. AskOption) and let
        // the user choose the CDRom drive where he would put his CDRom(*)

  else // typical situation: PC with only one CD Rom drive!
     #ifdef DEBUG_LEVEL_1
        SdShowInfoList ("CDRom Information", "CDRom drive letter is:", lCDRom);
     #endif
     ListGetFirstString (lCDRom, CDSetupRoot);
     CDSetupRoot = CDSetupRoot + ":\\";
     #ifdef DEBUG_LEVEL_1
        SprintfBox (INFORMATION, "CDRom information", "CDRom root directory is: %s",
                    CDSetupRoot);
     #endif
  endif;
endif;


(*)browsing the Help It seems to me there is a way to do that:

Code Sample

CtrlSetList(szDialogName, nControlID, listID);
Description
The CtrlSetList function places the contents of a string list into the specified single- or multi-selection list box or combo box control. Any pre-existing contents are replaced with the items contained in listID. InstallShield places each element of the string list into each element of the list box or combo box control


But I found the implementation quite difficult, anyone can help me to better understand it?
What's a list box / combo box?
Is it possible to places the contents of a string list into a Dialog Box? (i.e. AskOption)


Thanks.
Ciao, Giuseppe



EberhardH

EberhardH
  • Members
  • 137 posts

Posted 22 November 2002 - 09:19

Hi,

(I must apologize for being short of time)

To briefly answer your 1st item:
once you know the drive letter of your CD ROM drive (your 2nd item) check if the root directory does there exist. If not: no media was inserted. As far as I understood the help file it does not seem to mean an inserted medium but a drive.

EberhardH