| | |
| | | //string startupPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup); // 启动文件夹路径 |
| | | //CreateShortcut(shortcutName, targetPath, startupPath); // 创建快捷方式 |
| | | |
| | | SetRegistryAutoStart("MaDataCapture", Application.ExecutablePath); |
| | | SetRegistryAutoStart("MaDataCapture", Application.ExecutablePath); // 注册表方式实现自启动 |
| | | |
| | | StartReceive(); // 启动程序 |
| | | CreateDatabase(); // 初始化数据库 |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show($"设置开机自启动失败:{ex.Message}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); |
| | | MessageBox.Show($"设置开机自启动失败:{ex.Message},请进行手动启动", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); |
| | | } |
| | | } |
| | | private void CaptrueForm_FormClosing(object sender, FormClosingEventArgs e) |