string ls_WindowsDirctory ,is_winpathfile
ulong lu_Buf
lu_Buf = 144
ls_WindowsDirctory = Space(144)
GetWindowsDirectoryA(ls_WindowsDirctory,lu_Buf)
messagebox(ls_WindowsDirctory,ls_WindowsDirctory)
is_winpathfile = ls_WindowsDirctory + "/win.ini"
string ls_printer
ls_printer =ProfileString("cy.INI","printer_2","print_2"," ")
if trim(ls_printer)='' or isnull(ls_printer) then
else
//修改win.ini文件
setprofilestring(is_winpathfile,"windows","device",ls_printer + "," +ls_printer)
//修改注册表文件
RegistrySet("HKEY_CURRENT_USER/Software/Microsoft/Windows NT/CurrentVersion/Windows","Device", ls_printer)
dw_3.print()
end if
ls_printer =ProfileString("cy.INI","printer_1","print_1","")
if trim(ls_printer)='' or isnull(ls_printer) then
else
//修改win.ini文件
setprofilestring(is_winpathfile,"windows","device",ls_printer + "," +ls_printer)
//修改注册表文件
RegistrySet("HKEY_CURRENT_USER/Software/Microsoft/Windows NT/CurrentVersion/Windows","Device", ls_printer)
dw_3.print()
end if
HKEY_CURRENT_USER/Software/Microsoft/Windows NT/CurrentVersion/Windows/Device键值即为默认打印机的注册表值,
先试着修改默认打印机,记住该键值的每次变化,将变化键值写入cy.ini,并在程序中相应读取,重设注册表值后进行打印,随然是先打印一个再打印另一个,但也实现了一个打印按钮的两台打印机打印