Solved

Fake a CD?

Posted on 1997-04-21
22
389 Views
Last Modified: 2006-11-17
I want to make a little utility (for myself) for Win '95 with VB4.0.
I want to have these parts on a form:
a drivelist,
a directorylist,
a textbox and
a button
It should do this:
You should select a drive and directory that you want to use in those lists.
in the textbox you input a free valid drive letter.
and the button for starting the procedure.
The procedure would be:
Take the drive and directory from the lists and fake these as a CD-ROM on drive letter specified in the textbox.
I have a program called FAKECD that does all this for me, the only problem with it is that it just works in DOS and not in Win'95.
So, what I want is to redo that program in VB code. Anyone who would like the program can get it, just add a comment with your e-mail and a text specifiyng what you want.

PLEASE HELP ME!! IT'S VERY IMPORTANT FOR ME!!

// Gustav
0
Comment
Question by:Gustav
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 5
  • 2
  • +3
22 Comments
 
LVL 1

Expert Comment

by:milton042297
ID: 1425567
This is a code sample for Microsoft Access but it will work properly for your case in Visual Basic 4.0.



The sample program below uses several functions to control basic CD-ROM drive features such as stop, play, and eject. The functions can be used in any CD-ROM application you create. The sample program below is not a complete application, but is rather a basis you can use to create a full-featured application.
 
The simplest way to use these functions is to create a form with five command buttons on it. Have each of the buttons call one of the five sample functions below with its OnPush property.
 
To create these functions, create a new Access Basic module and enter the following Declarations and functions.
 
NOTE: In the following sample code, an underscore (_) is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.
 
NOTE: You may have these Microsoft Windows API functions defined in an
existing Microsoft Access library or module; therefore, your delarations may be duplicates causing a duplicate procedure name error message. There are two resolutions to this error:
 
 - Remove or comment out the duplicated declarations statements.
 
 - Use function aliasing by replacing the phrase "alias_" throughout the code below with your own unique aliasing characters. This method allows you to remove the other module and not lose the declarations for the API functions in the new module.
 
 
   '******* Declarations Section *******
 
   Option Compare Database
   Option Explicit
 
   Declare Function alias_mciSendString& Lib "MMSystem" alias_
   "mciSendString" (ByVal Sound$, ByVal RtnString$,_
   ByVal RtnLength%, ByVal Hndl%)
 
   Dim RetInt As Integer
   Dim RetStr As String * 64
   Dim mciStatement As String
 
   Global gTrackCurrent As Integer ' stores current track on CD.
   Global gTrackCount As Integer   ' stores count of tracks on CD.
 
   '******* Play Function *********
 
   Function CDPlay () As Integer
      ' This function initializes the audio device
      ' with the first call to mciSendString(), and
      ' then starts the CD playing with the second call.
 
      RetInt = alias_mciSendString("Open CDAudio", "", 0, 0)
      CDPlay = alias_mciSendString("Play CDAudio", "", 0, 0)
   End Function
 
   '******* Stop Function **********
 
   Function CDStop () As Integer
      ' This function stops the CD with the first call
      ' to mciSendString(), and closes the audio device
      ' with the second call.
      RetInt = alias_mciSendString("Stop CDAudio", "", 0, 0)
      CDStop = alias_mciSendString("Close CDAudio", "", 0, 0)
   End Function
 
   '******** Previous Track Function **********
 
   Function CDTrackPrevious ()
      Dim TrackPrevious As Integer
 
      ' Set time format to Tracks, minutes, seconds, and frames.
      RetInt = alias_mciSendString("Set CDAudio Time Format TMSF",_
      "", 0, 0)
 
      ' Retrieve the track number that is currently playing, and
      ' the total number of tracks on the CD. Store these values
      ' in global variables so that they are available to the form.
 
      mciStatement = "Status CDAudio Current Track"
      RetInt = alias_mciSendString(mciStatement, RetStr, 63, 0)
      gTrackCurrent = Val(RetStr)
      TrackPrevious = gTrackCurrent - 1
      mciStatement = "Status CDAudio Number of Tracks"
      RetInt = alias_mciSendString(mciStatement, RetStr, 63, 0)
      gTrackCount = Val(RetStr)
 
      ' Check to see if the current track is the first track. If it
      ' is seek to the beginning of the current track and play it.
      ' Otherwise, move to the previous track and play from there to
      ' the end of the CD.
 
      If TrackPrevious > 0 Then
         mciStatement = "Play CDAudio from " & TrackPrevious
         mciStatement = mciStatement & " To " & gTrackCount
         CDTrackPrevious = alias_mciSendString(mciStatement, "", 0, 0)
      Else
         mciStatement = "Seek CDAudio to " & TrackPrevious
         RetInt = alias_mciSendString(mciStatement, "", 0, 0)
         CDTrackPrevious = alias_mciSendString("Play CDAudio", "", 0, 0)
      End If
   End Function
 
   '********** Next Track Function **********
 
   Function CDTrackNext () As Integer
      Dim TrackNext As Integer
 
      ' Set time format to Tracks, minutes, seconds, and frames.
      RetInt = alias_mciSendString("Set CDAudio Time Format TMSF",_
      "", 0, 0)
 
      ' Retrieve the track number that is currently playing, and
      ' the total number of tracks on the CD. Store these values
      ' in global variables so that they are available to the form.
 
      mciStatement = "Status CDAudio Current Track"
      RetInt = alias_mciSendString(mciStatement, RetStr, 63, 0)
      gTrackCurrent = Val(RetStr)
      TrackNext = gTrackCurrent + 1
      mciStatement = "Status CDAudio Number of Tracks"
      RetInt = alias_mciSendString(mciStatement, RetStr, 63, 0)
      gTrackCount = Val(RetStr)
 
      ' Check to see if the current track is the last track. If it
      ' is seek to the beginning of the last track and play it.
      ' Otherwise, move to the next track and play from there to the end
      ' of the CD.
 
      If (TrackNext) < gTrackCount Then
          mciStatement = "Play CDAudio from " & TrackNext
          mciStatement = mciStatement & " To " & gTrackCount
          CDTrackNext = alias_mciSendString(mciStatement, "", 0, 0)
       Else
          mciStatement = "Seek CDAudio to " & gTrackCurrent
          RetInt = alias_mciSendString(mciStatement, "", 0, 0)
          CDTrackNext = alias_mciSendString("Play CDAudio", "", 0, 0)
      End If
   End Function
 
   '********* Eject Function **********
 
   Function CDEject () As Integer
      ' This function is not supported by all CD devices.
      CDEject = alias_mciSendString("Set CDAudio Door Open", "", 0, 0)
   End Function
 
   '********* Pause Function **********
 
   Function CDPause () As Integer
      CDPause = alias_mciSendString("Stop CDAudio", "", 0, 0)
   End Function
 
'*****************************************************************

That's all, good luck.
0
 

Author Comment

by:Gustav
ID: 1425568
Edited text of question
0
 

Author Comment

by:Gustav
ID: 1425569
Milton, that was some good code(, that I already knew).
But it wasn't the thing I wanted.
0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 

Author Comment

by:Gustav
ID: 1425570
Adjusted points to 200
0
 
LVL 1

Expert Comment

by:advapp
ID: 1425571
I'd be willing to take a look at this.  It does not sound too difficult.
Send the code to rod@plaza.ds.adp.com
0
 

Author Comment

by:Gustav
ID: 1425572
Adjusted points to 215
0
 

Expert Comment

by:schneidd
ID: 1425573
If i understand you right, you want to associate a path with a drive letter, right?

Well, there is the DOS command SUBST.EXE in Windows\Command\ (try subst /? in a DOS-Box).

If you don't want to place a SUBST.EXE command in your autoexec.bat, you could simply write a VB caller program.

I hope this helps you
0
 

Author Comment

by:Gustav
ID: 1425574
schneidd(, and all other people reading this), I know about subst and a lot of other programs like it.
The problem is that these programs doesn't make the system believe that the drive is a CD-ROM.
The only one I discovered that does this CD-thing is the DOS tsr FAKECD. But that doesn't work in Win95.
Do you think you get the problem?
0
 

Author Comment

by:Gustav
ID: 1425575
Adjusted points to 220
0
 

Expert Comment

by:schneidd
ID: 1425576
Hi Gustav,

I have tried out FAKECD with Windows 95 (v4.00.950a), and IT WORKS!!!

Maybe, you have not the actual version. I have found FAKECD10.ZIP (8.007 Bytes) at the following Address: "http://whirligig.ecs.soton.ac.uk/~sjl495/cdemu/index.htm"

This site also has some other fake cd tools (but all are for DOS).

I have installed the program with the following command line in my autoexec.bat: "LoadHigh C:\CdRom\FakeCD10\FakeCD.Exe D:\CD-ROM /l:h".

After rebooting, - tadaa - there is a new Drive "H:" in the Explorer, and it's recognised as a CD-ROM drive (but it's not write protected).

FAKECD.EXE does not work, if launched in a DOS-Box.
Maybe, if you have the newest Version of Win95 (that with the new FAT32) this could also be a reason, why it doesn't work on your machine.

Greetings Detlef
0
 

Author Comment

by:Gustav
ID: 1425577
Yes, I know it works when you put it in autoexec.bat.
It does work with FAT32 too, but I wonder if there is a way to do this inside Win95, but if there isn't I will gladly give you the points.
0
 

Author Comment

by:Gustav
ID: 1425578
Adjusted points to 225
0
 

Expert Comment

by:RoBo
ID: 1425579
Hi we use facke cd for quake, c&c, RedAlert, KKND. when we want to use these we make a batch file for the program and load the fakecd  then run the game and the unload fakecd. some games don't like the real mscdex.exe loaded before fakecd. so instead of geting vb to do the wok get it to make a batch file for u. then again this has only been proven for Fat16, Good Luck
0
 

Author Comment

by:Gustav
ID: 1425580
Adjusted points to 265
0
 
LVL 5

Accepted Solution

by:
y96andha earned 260 total points
ID: 1425581
Bad news: It is impossible to create such a program in Visual Basic.

Good news: There is already a program (not written in Visual Basic) to do this. Go to this url: http://www.logicraft.com/data/vcd.htm
0
 
LVL 5

Expert Comment

by:y96andha
ID: 1425582
I found there was no link back from the page I mentioned.

URL for direct download is http://www.logicraft.com/dwnld/dwnld.htm
0
 

Author Comment

by:Gustav
ID: 1425583
That program is probably great, but there are two problems:
1. I can't download it.
2. I thought of making an own program, so now there is a question for you wich language shall I use?
0
 
LVL 5

Expert Comment

by:y96andha
ID: 1425584
1. Why can't you download it?

2. I think Microsoft Visual C++ would be a good choice. You need to get the Windows 95 DDK too. But I must warn you that it's not a simple project, it would probably take quite some time just to dig into the DDK and understand how to develop Win95 device drivers.

You can look at the DDK documentation on the web at http://premium.microsoft.com/msdn/library/
0
 

Author Comment

by:Gustav
ID: 1425585
When I try to send my info to get the download there is a grey screeen saying that it can't be found or something,
have it worked for you?
0
 
LVL 5

Expert Comment

by:y96andha
ID: 1425586
Yes, it has worked. I have not downloaded the 95 version, but I have the NT version OK. If you would like, I could get the 95 version and then e-mail it to you?
0
 

Author Comment

by:Gustav
ID: 1425587
Yes that would be nice, my e-mail is:
munkby@mbox300.swipnet.se
but I couldn't download the NT version either, I don't know why, do you, maybe because im from Sweden?
0
 
LVL 5

Expert Comment

by:y96andha
ID: 1425588
OK, jag skickar över den just nu. Hoppas det går bra.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month5 days, 4 hours left to enroll

635 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