'printer change to registry for 2000 and XP and NT4 Public RegOpenKey() Public RegSetValueEx() Public RegCloseKey() Public hKey Public lpSubKey Public ulOptions Public samDesired Public phkResult Public HKEY_CURRENT_USER Public dwType Public lpData Public cbData Public REG_SZ public hr public buf Public HWND_BROADCAST Public WM_SETTINGCHANGE Public SMTO_ABORTIFHUNG Public smtres main local result WINLIB w lparam buffer buf sizeof "L" HKEY_CURRENT_USER = 0x80000001 REG_SZ = 1 hKey = HKEY_CURRENT_USER lpSubKey = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows" hr = RegOpenKey() unpack buf "L" phkResult hKey = phkResult lpSubKey = "Device" dwType = REG_SZ 'place your printer name on the next line 'lpData = "HP LaserJet 5P,winspool,LPT1:" lpData = "Auto HP LaserJet 5P on WORKPC,winspool,Ne04:" 'lpData = "Microsoft Office Document Image Writer,winspool,Ne01:" cbData = len(lpData) + 1 hr = RegSetValueEx() hr = RegCloseKey() HWND_BROADCAST = 0xFFFF WM_SETTINGCHANGE = 0x1A SMTO_ABORTIFHUNG = 0x02 w = "Windows" lparam = dosptr(w) dll load "user32.dll" WINLIB dll call WINLIB function "SendMessageTimeoutA" stack "LLLPLLP" HWND_BROADCAST WM_SETTINGCHANGE 0 lparam SMTO_ABORTIFHUNG 500 dosptr(smtres) result = getreg(ax) dll unload WINLIB 'message str(result) end main Function RegOpenKey() local WINLIB local result dll load "advapi32.dll" WINLIB dll call WINLIB function "RegOpenKeyA" stack "LPP" hKey dosptr(lpSubKey) dosptr(buf) result = getreg(ax) dll unload WINLIB return result End Function Function RegSetValueEx() local WINLIB local result dll load "advapi32.dll" WINLIB dll call WINLIB function "RegSetValueExA" stack "LPLLPL" hKey dosptr(lpSubKey) 0 dwType dosptr(lpData) cbData result = getreg(ax) dll unload WINLIB return result End Function Function RegCloseKey() local WINLIB local result dll load "advapi32.dll" WINLIB dll call WINLIB function "RegCloseKey" stack "L" hKey result = getreg(ax) dll unload WINLIB return result End Function