View Single Post
  #9 (permalink)  
Old 9th January 2003
Bubba Bubba is offline
Junior Member
BS.Player Newbie
Join Date: Dec 2002
Posts: 7
Rep Power: 0
Bubba is an unknown quantity at this point

No Problem - if I knew c++ then the app would have been written entirely in it - i only use vb cause im too busy with school work to learn c++ yet. Anyway, here's the information I think you are after. The nsi file that builds the installer also creates all the necessary registry entries that are required for autorun v2 to show bsplayer. Below is the required registry code:
  ;Write Registry Settings
  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\BSPlayVideoFiles" "Action" "Play These Video Files"
  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\BSPlayVideoFiles" "DefaultIcon" "$INSTDIR\bplay.exe,0"
  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\BSPlayVideoFiles" "InvokeProgID" "BSPlayerAutorun"
  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\BSPlayVideoFiles" "InvokeVerb" "BSPlayerAutorun_scan"
  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\BSPlayVideoFiles" "Provider" "BSPlayer"
  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoFilesOnArrival" "BSPlayVideoFiles" ""
  WriteRegStr HKCR "BSPlayerAutorun\shell\BSPlayerAutorun_scan" "" "Play These Video Files"
  WriteRegStr HKCR "BSPlayerAutorun\shell\BSPlayerAutorun_scan\command" "" '"$INSTDIR\bsplayrun.exe" "%L"'
Now, all the HKLM registry are written to the HKEY LOCAL MACHINE part of the registry, where you provide the handler details, and some other detials such as the text labels "Provider". Now, this also writes the name of our handler into the necessary eventhandlers part. The key parts come from the "InvokeVerb" and "InvokeProgID" parts within the handler. The invokeprogid refrences to a class found in HKEY_CLASSES_ROOT part of the registry - called "BSPlayerAutorun". All this is is a key created in the HKEY_CLASSES_ROOT called "BSPlayerAutorun". Then, the invokeverb specifies which action within the "BSPlayerAutorun" class should be performed, which in my case is "BSPlayerAutorun_scan". To set the description like "Play these videos", simply set the default string value of the action to the text you want to show. Then, the following line of code sets the command to be run when this action is selected.

"BSPlayerAutorun\shell\BSPlayerAutorun_scan\command" "" '"$INSTDIR\bsplayrun.exe" "%L"'
Now, here the $INSTDIR bit becomes the installation location, and the "%L" bit is a variable that windows xp replaces with the root location of the drive that you just inserted the media into, for example "G:" in my case. This MAY NOT include a trailing \ - it didn't in my case! A full list of variables is available on the MSDN site (I think!).

Hopefully I've made everything a bit clearer - the actual app in vb doesn't do much - it simply checks the inserted cd for files matching the specified extensions and adds them to a playlist file, then tells bsplayer to open it. All of the serious registry work is done by the nsis installation script. If you need any more info either post here or e-mail / pm me.


Reply With Quote

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20