Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'd like to capture the CD Insert or Autorun (if enabled) if possible.

 

Here is the scenario. I am developing MyApp 2.0 that reads content distributed on CDs or DVDs. Unfortunately, the content CDs used with MyApp 1.0 included an autorun file that either installed MyApp 1.0 or launched an existing MyApp 1.0 installation. If the end-user already has MyApp 2.0 installed, I do not want old CDs containing MyApp 1.0 to attempt to install the legacy application when inserted into the drive.

 

Is there a way to detect and prevent that from happening?

"Never ascribe to malice that which can adequately be explained by incompetence." -- Napolean Bonaparte
  • Leaders
Posted

Hmm... seems like it would just be easier to store the current version of YourApp somewhere on the computer (registry?) and then, when you want to install your app, check to make sure that CurrentVersion is < this version.

 

It would be kind of hair-raising trying to continually scan for a CD or Autorun.exe while your app is running... and then to kill it... :-\.

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Posted
Hmm... seems like it would just be easier to store the current version of YourApp somewhere on the computer (registry?) and then, when you want to install your app, check to make sure that CurrentVersion is < this version.

 

It would be kind of hair-raising trying to continually scan for a CD or Autorun.exe while your app is running... and then to kill it... :-\.

Thanks for the suggestion, and it is a good one, but unfortunately the folks that wrote MyApp 1.0 had no such scheme in place. When the end-user inserts a MyApp 1.0 CD, the autorun will install version 1.0 of the application unless the user cancels out at some point.

 

The good part is that the end-user would probably insert the old CD only at the prompting of the new application. Therefore, I could scan for the Insert/Autorun event only until the end-user inserts the legacy media or cancels the request.

 

Any other suggestions are still needed and welcome.

"Never ascribe to malice that which can adequately be explained by incompetence." -- Napolean Bonaparte
Posted

I try to keep track of where the cd is in my burning app with this:

 

   Private Const WM_DEVICECHANGE As Integer = 537
   Private Const DBT_DEVICEREMOVECOMPLETE As Integer = 32772
   Private Const DBT_DEVICEARRIVAL As Integer = 32768
   Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
       'Handle the CD messages
       Select Case m.Msg
           Case WM_DEVICECHANGE
               If (m.WParam.ToInt32() = DBT_DEVICEREMOVECOMPLETE) Then
                   CDIsInserted = False
                   Me.TextBox1.Text &= "CD ejected/unavailable/burning" & vbCrLf
               ElseIf (m.WParam.ToInt32() = DBT_DEVICEARRIVAL) Then
                   CDIsInserted = True
                   Me.TextBox1.Text &= "CD Inserted/finished burning" & vbCrLf
               End If
           Case Else
               'Call base WndProc for default handling
               MyBase.WndProc(m)
       End Select
   End Sub

 

might be of use...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...