马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?站点注册
×
【路人】CHOATE(372704175) 16:18:10
是啊。我客户端不用设置就这样运行软件自动注册
- String ls_system_dir ,ls_barcode_file ,ls_driver_file
- String ls_reg_key = 'HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\'
- String ls_source_name = 'BESTAR BARCODE'
- ulong li_buf
- li_buf = 144
- ls_system_dir = Space(144)
- GetSystemDirectoryA(ls_system_dir, li_buf)
- ls_reg_key = ls_reg_key + ls_source_name
- ls_barcode_file = gs_current_path + '\barcode.mdb'
- ls_driver_file = ls_system_dir + '\odbcjt32.dll'
- RegistrySet(ls_reg_key ,'DBQ' ,RegString! ,ls_barcode_file)
- RegistrySet(ls_reg_key ,'Driver' ,RegString! ,ls_driver_file)
- RegistrySet(ls_reg_key ,'DriverId' ,ReguLong! ,25)
- RegistrySet(ls_reg_key ,'FIL' ,RegString! ,'MS Access;')
- RegistrySet(ls_reg_key ,'SafeTransactions' ,ReguLong! ,0)
- RegistrySet(ls_reg_key ,'UID' ,RegString! ,'Admin')
- //在ODBC Data Sources中加入数据源,以便在控制台的ODBC32中能出现
- String ls_profile[] ,ls_source_engine
- Integer li_rtn ,li_loop ,li_pos
- Boolean lb_flag
- lb_flag = False
- ls_reg_key = 'HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI'
- li_rtn = RegistryKeys(ls_reg_key ,ls_profile[])
- For li_loop = 1 To UpperBound(ls_profile[])
- li_pos = Pos(ls_profile[li_loop] ,'(*.mdb)')
- If li_pos > 0 Then
- ls_source_engine = ls_profile[li_loop]
- lb_flag = True
- Exit
- End If
- Next
- //注册到当前户的ODBC数据源中
- ls_reg_key = 'HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources'
- If lb_flag = True Then
- RegistrySet(ls_reg_key ,ls_source_name ,RegString! ,ls_source_engine)
- End If
- tr_barcode = Create Transaction ;
- tr_barcode.DBMS = "ODBC"
- tr_barcode.AutoCommit = False
- tr_barcode.DBParm = "ConnectString='DSN=BESTAR BARCODE;UID=Admin;PWD='"
- Connect Using tr_barcode ;
复制代码
你们试一下,我用了10多年,
|