CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selected Item and Browse CD?



Steven;

As soon as I get an answer back on "Right Drive or Lastdrive?" You can use
that function to pinpoint the CDRom drive letter, then use the WinExec( )
or ShellExecute( ) to launch Explorer with this command line>>

Explorer.exe / n , / e , / select , D:\

(Note: I put spaces in the commandline parameters so you could see the
commas. They are required. But do not put spaces in the actual parameters.
Where D:\ is, would be the CD drive. You'll have to play with string
concateration to complete the parameter. This would launch explorer with
the contents of the CD drive showing in the right pane, and the drive
highlighted in the left pane. In my GetCDPath function,
PathSet[ps+1].c_str() returns the path as a NULL terminated string, but
since it's used at the end, I don't think it matters. Otherwise you'd have
to trim it.)

The following function is out of Harold Howe's "How to" book. You'll want
to Check for a disk before launching Explorer. Don't forget to declare the
function in the header.
bool CheckForDisk(void);

/* to call CheckForDisk( ) from your launch function*/
if (!CheckForDisk())
	{
	ShowMessage("No disk in CD Drive.\n"
			"Insert disc and try again.");
	return;
	}
else
{
/*WinExec() or ShellExecute()*/
}

void __fastcall Form1::CheckForDisk(void)
{
MCI_STATUS_PARAMS Status;
Status.dwItem = MCI_STATUS_MEDIA_PRESENT;
return (bool)Status.dwReturn;
}

I was working on a advertizement drawing program that calls backgrounds and
textures from the CD (right now they're on the Harddrive but take up about
125MB). So it would seem we're along the same track somewhere...?!

Rick Malik
rmfci@pacbell.net
"Visit the C++ Builder Hobby Pages"
http://home.pacbell.net/rmfci/bcbhp.htm


W Komornicki's Home Page | Main Index | Thread Index