VagabondSW Posted June 27, 2005 Posted June 27, 2005 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? Quote "Never ascribe to malice that which can adequately be explained by incompetence." -- Napolean Bonaparte
Leaders Iceplug Posted July 1, 2005 Leaders Posted July 1, 2005 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... :-\. Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
VagabondSW Posted July 5, 2005 Author Posted July 5, 2005 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. Quote "Never ascribe to malice that which can adequately be explained by incompetence." -- Napolean Bonaparte
jo0ls Posted July 11, 2005 Posted July 11, 2005 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... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.