peaveyyyy
New member
- Joined
- Jun 9, 2009
- Messages
- 3
- Programming Experience
- 3-5
I have successfully dreated an application that recognises when a new drive or memory card is plugged in and allows the extraction of images from the drive (using Autoplay, basically). I simply registered the application with the Regsitry like this:
Imports System.ComponentModel
Imports System.Configuration.Install
Imports Microsoft.Win32
Public Class Register
Private ProgramID As String = "PicCreator"
Private RegistryClass As String = "\shell\open\command\"
Private RegistryEventHandlers As String = "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\ShowPicturesOnArrival\"
Private RegistryHandlers As String = "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\"
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add initialization code after the call to InitializeComponent
End Sub
Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)
MyBase.Install(stateSaver)
Dim ApplicationPath As String = Me.Context.Parameters.Item("ApplicationPath") & "PicCreator.exe"
Dim AddClassValue As RegistryKey = Registry.ClassesRoot.CreateSubKey(ProgramID & RegistryClass, RegistryKeyPermissionCheck.ReadWriteSubTree)
AddClassValue.SetValue(Nothing, ApplicationPath & " %L")
AddClassValue.Close()
'Add to ShowPicturesOnArrival
Dim AddEventHandlers As RegistryKey = Registry.LocalMachine.OpenSubKey(RegistryEventHandlers, True)
AddEventHandlers.SetValue(ProgramID, "")
AddEventHandlers.Close()
'Add to Handlers
Dim AddHandlers As RegistryKey = Registry.LocalMachine.CreateSubKey(RegistryHandlers & ProgramID, RegistryKeyPermissionCheck.ReadWriteSubTree)
AddHandlers.SetValue("Action", "Create pictures with PicCreator")
AddHandlers.SetValue("DefaultIcon", ApplicationPath & ",0")
AddHandlers.SetValue("InvokeProgID", ProgramID)
AddHandlers.SetValue("InvokeVerb", "open")
AddHandlers.SetValue("Provider", "PicCo")
End Sub
End Class
Now, I want the same application to recognise and AutoPlay when a camera is plugged in instead of a drive, or simply to recognise the drive on the camera instead of the camera. This I know uses WIA, but all the WIA documentation seems to be a little beyond me. It goes on about having to use interfaces and the like. Is there no equivalent of the simple registry changes I made to Autoplay drives that I can use for this? I only want the app to browse the camera automatically and display any pictures on its memory card.
Imports System.ComponentModel
Imports System.Configuration.Install
Imports Microsoft.Win32
Public Class Register
Private ProgramID As String = "PicCreator"
Private RegistryClass As String = "\shell\open\command\"
Private RegistryEventHandlers As String = "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\ShowPicturesOnArrival\"
Private RegistryHandlers As String = "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\"
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add initialization code after the call to InitializeComponent
End Sub
Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)
MyBase.Install(stateSaver)
Dim ApplicationPath As String = Me.Context.Parameters.Item("ApplicationPath") & "PicCreator.exe"
Dim AddClassValue As RegistryKey = Registry.ClassesRoot.CreateSubKey(ProgramID & RegistryClass, RegistryKeyPermissionCheck.ReadWriteSubTree)
AddClassValue.SetValue(Nothing, ApplicationPath & " %L")
AddClassValue.Close()
'Add to ShowPicturesOnArrival
Dim AddEventHandlers As RegistryKey = Registry.LocalMachine.OpenSubKey(RegistryEventHandlers, True)
AddEventHandlers.SetValue(ProgramID, "")
AddEventHandlers.Close()
'Add to Handlers
Dim AddHandlers As RegistryKey = Registry.LocalMachine.CreateSubKey(RegistryHandlers & ProgramID, RegistryKeyPermissionCheck.ReadWriteSubTree)
AddHandlers.SetValue("Action", "Create pictures with PicCreator")
AddHandlers.SetValue("DefaultIcon", ApplicationPath & ",0")
AddHandlers.SetValue("InvokeProgID", ProgramID)
AddHandlers.SetValue("InvokeVerb", "open")
AddHandlers.SetValue("Provider", "PicCo")
End Sub
End Class
Now, I want the same application to recognise and AutoPlay when a camera is plugged in instead of a drive, or simply to recognise the drive on the camera instead of the camera. This I know uses WIA, but all the WIA documentation seems to be a little beyond me. It goes on about having to use interfaces and the like. Is there no equivalent of the simple registry changes I made to Autoplay drives that I can use for this? I only want the app to browse the camera automatically and display any pictures on its memory card.