Solved

How do I prompt user to insert Windows installation CD to install a file from there?

Posted on 1998-12-04
3
222 Views
Last Modified: 2010-04-02
Hi,

I am writing a setup program and I want the user to install the latest
version of, let's say, unidrv.dll, from the Windows installation CD. How
would I prompt the user to insert the CD, get the file and ask them to
reboot if neccessary?

If anyone can help me, I really appreciate it.

Thanks,
Sinping
0
Comment
Question by:sinping
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
trillo earned 100 total points
ID: 1179217
Your install program should check:
1) First locate which drive is the CD-ROM. You use  the GetLogicalDrives or the GetLogicalDriveStrings functions to know which drive letters are available.
2) Use GetDriveType to know which one of the drives is a CD-ROM
3) You must know the VolumeLabel of the CD, in order to know if the correct CD is in the Drive. This can be done using the GetVolumeInformation function.
4) If the wrong CD is in drive you prompt the user with a MessageBox to insert the correct CD (When the user presses OK you go back to step (3) until the correct disk is in the CD-ROM.

Optional and Extreme Luxe: How do you know when the Cd door is closed?.. Well, you catch the WM_DEVICECHANGE message with the DBT_DEVICEARRIVAL      parameter (wParam). This will notify your app when a new disk has been inserted in the CD-ROM.

5) You do your necessary file operations, reading from the CD and writing to the Hard Disk.

------------ To reboot
If you decide that the changes made by the Setup program need the computer to rebbot you must use the ExitWindowsEx fucntion with the EWX_REBOOT flag in the first parameter.

I hope to have helped you. I fyou need more help, tell me... also if you need the declarations for the functions I mentioned (you can find the in your developmnet tool help files)

Trillo
0
 

Author Comment

by:sinping
ID: 1179218
Your answer is helpful. However, for different OS, the layout of the CDs are different. How will I know where on the CD to look for the file? For example, Win98 CD has all those Win98.cab files.

Is there a particular SDK function to perform the update? On Win95, Win98 and Win NT?
0
 
LVL 2

Expert Comment

by:trillo
ID: 1179219
Not that I know, I think you have to build some algorithm to detect all the cabinet files in the CD
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question