Date: 02-16-2022
Return to Index
created by gbSnippets
'Primary Code:
'Credit: Semen Matusovski
'Compilable Example: (Jose Includes)
'Registers an extension in the registry. Requires reboot to
'take effect.
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Register None
#Dim All
%Unicode=1
#Debug Error On 'catch array/pointer errors - OFF in production
#Debug Display On 'display untrapped errors - OFF in production
#Include "Win32Api.Inc"
'%HKEY_CLASSES_ROOT = &H80000000 - from win32api.inc
'%REG_SZ = 1 - from win32api.inc
$Extention = ".gbs"
$Title = "gbSnippets"
$Path = "c:\data\apps\powerbasic\apps_gbapps\gbsnippets\gbsnippets.exe"
$Cmt = "gbSnippets Source Code Library"
Function PBMain
Dim KeyName As Asciiz * 256
Dim KeyValue As Asciiz * 256
Dim KeyHandle As Long
KeyName = $Extention: KeyValue = $Title
RegCreateKey %HKEY_CLASSES_ROOT, KeyName, KeyHandle
RegSetValue KeyHandle, "", %REG_SZ, KeyValue, 0&
RegCloseKey KeyHandle
KeyName = $Title: KeyValue = $Cmt
RegCreateKey %HKEY_CLASSES_ROOT, KeyName, KeyHandle
RegSetValue KeyHandle, "", %REG_SZ, KeyValue, 0&
RegCloseKey KeyHandle
KeyName = $Title: KeyValue = $Path + " %1"
RegCreateKey %HKEY_CLASSES_ROOT, KeyName, KeyHandle
RegSetValue KeyHandle, "shell\open\command", %REG_SZ, KeyValue, %MAX_PATH
RegCloseKey KeyHandle
MsgBox "Done!"
End Function
'gbs_00542
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm