Started by LiTTleDRAgo, November 23, 2018, 03:56:58 am
Quote from: winkioI do not speak to bricks, either as individuals or in wall form.
Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.
OpenKey = Win32API.new('advapi32', 'RegOpenKeyEx', 'lpllp', 'l')SetKey = Win32API.new('advapi32', 'RegSetValueEx', 'lpllpl', 'l')CloseKey = Win32API.new('advapi32', 'RegCloseKey', 'l', 'l')handle = .pack('L')key = [0x80000001, # HKEY_CURRENT_USER , ref: https://www.rubydoc.info/stdlib/dl/2.0.0/Win32/Registry/Constants 'Software\\Enterbrain\\RGSS', 0, 2, #KEY_SET_VALUE handle]p OpenKey.call(*key) # successful = 0hkey = handle.unpack('L').firstval = .pack('L')reg = [hkey, 'PlaySound',#'SmoothMode', 0, # reserved, keep it 0 0x10, #REG_DWORD val, # value to be set 4] # size of value, in bytesp SetKey.call(*reg) # successful = 0p CloseKey.call(hkey)
QuoteThe RegCloseKey function does not necessarily write information to the registry before returning; it can take as much as several seconds for the cache to be flushed to the hard disk. If an application must explicitly write registry information to the hard disk, it can use the RegFlushKey function. RegFlushKey, however, uses many system resources and should be called only when necessary.