侧边栏壁纸
博主头像
v林羽博主等级

行动起来,活在当下

  • 累计撰写 171 篇文章
  • 累计创建 34 个标签
  • 累计收到 14 条评论

目 录CONTENT

文章目录

【Linux使用】之--通过wine完美运行通达信等股票软件

v林羽
2023-04-08 / 0 评论 / 0 点赞 / 2153 阅读 / 8346 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2023-11-01,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

【Linux使用】之–通过 wine 完美运行通达信等股票软件

#系统 #Linux #教程 #虚拟机 #arch #archlinux #股票

Linux 原生股票软件如同花顺(cn.com.10jqka)功能少的可怜,经常会出现崩溃的情况,Windows 下的股票行情软件功能都非常丰富,所以在 Linux 下看股票,一般都会选择虚拟机,而且委托交易也只能通过这种方式运行,但对于笔记本用户打开虚拟机后风扇经常会呼呼起飞影响看盘。本篇记录一下通过 wine 的方式安装运行通达信,解决字体乱码、花屏等问题。

1. 安装 wine

yay -S wine-staging
yay -S wine-gecko
yay -S wine-mono

通达信软件官网下载通达信安装程序 new_tdx.exe

# 此时,安装会出现字体问题,先退出
wine new_tdx.exe

2. 安装 wine 基础组件

yay -S winetricks-zh-git r235.77e5348-1
yay -S zenity  # 显示GTK+对话框,可以运行winetricks-zh的GUI模式

# 安装字体
winetricks-zh cjkfonts wenquanyi wenquanyizenhei

再次安装通达信,字体显示正常了

3. 解决运行错误

安装完毕后, 程序默认路径 /home/$USERNAME/.wine/drive_c/new_tdx/tdxw.exe

# 直接运行通达信程序,报错
~ wine ~/.wine/drive_c/new_tdx/tdxw.exe  
002c:fixme:winediag:LdrInitializeThunk wine-staging 8.5 is a testing version containing experimental patches.  
002c:fixme:winediag:LdrInitializeThunk Please mention your exact version when filing bug reports on winehq.org.  
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005  
0054:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.  
0054:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."  
0054:err:systray:initialize_systray Could not create tray window  
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005  
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005  
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005  
010c:err:module:import_dll Library MFC42.DLL (which is needed by L"C:\\new_tdx\\invest.dll") not found  
010c:err:module:import_dll Library invest.dll (which is needed by L"C:\\new_tdx\\tdxw.exe") not found  
010c:err:module:import_dll Library MFC42.DLL (which is needed by L"C:\\new_tdx\\TJyaid.dll") not found  
010c:err:module:import_dll Library TJyaid.dll (which is needed by L"C:\\new_tdx\\tdxw.exe") not found  
010c:err:module:import_dll Library MFC42.DLL (which is needed by L"C:\\new_tdx\\TQQCalc.dll") not found  
010c:err:module:import_dll Library TQQCalc.dll (which is needed by L"C:\\new_tdx\\tdxw.exe") not found  
010c:err:module:import_dll Library MFC42.DLL (which is needed by L"C:\\new_tdx\\TQQAnaly.dll") not found  
010c:err:module:import_dll Library TQQAnaly.dll (which is needed by L"C:\\new_tdx\\tdxw.exe") not found  
010c:err:module:LdrInitializeThunk Importing dlls for L"C:\\new_tdx\\tdxw.exe" failed, status c0000135
# 安装库mfc42*.dll,弹窗乱码,选择第一个
winetricks-zh mfc42

# 再次运行通达信,已经能正常打开了
wine ~/.wine/drive_c/new_tdx/tdxw.exe  

4. 解决字体乱码

# 新建注册表导入文件
vim ~/.wine/drive_c/fonts.reg

添加如下内容

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"Lucida Sans Unicode"="wqy-microhei.ttc"
"Microsoft Sans Serif"="wqy-microhei.ttc"
"Tahoma"="wqy-microhei.ttc"
"Tahoma Bold"="wqy-microhei.ttc"
"SimSun"="wqy-microhei.ttc"
"Arial"="wqy-microhei.ttc"
"Arial Black"="wqy-microhei.ttc"

# 运行wine注册表
wine regedit

进入 注册表 -> 导入注册表文件,选择刚才编辑的文件导入。

运行程序,正常了

字体可以通过 ctrl+d 进入系统设置修改

5. 几个问题

5.1. 扫码和其他方式登陆页面显示不正常。

# 未安装wine-gecko,重新安装
yay -S wine-gecko

# 安装后还是花屏、显示不正常,安装ie8和补丁
winetricks-zh ie8 ie8_kb2936068

5.2. 高分屏显示不正常

# 运行设置,修改dpi
winecfg

5.3. 如何多开

多开提示如下:

# 复制一个新文件夹
cp -r ~/.wine/drive_c/new_tdx ~/.wine/drive_c/new_tdx2

# 第一个窗口运行第一个
wine ~/.wine/drive_c/new_tdx/tdxw.exe

# 第二个窗口运行第二个
wine ~/.wine/drive_c/new_tdx2/tdxw.exe

# 根据自己需要复制多个,进行多开(同windows上一样,多个位置的通达信程序互相不影响)

多开效果

多开效果

5.4. 如何后台运行

nohup wine ~/.wine/drive_c/new_tdx/tdxw.exe > /dev/null 2>&1 &
nohup wine ~/.wine/drive_c/new_tdx2/tdxw.exe > /dev/null 2>&1 &

5.5. 隐藏等快捷键失效

由于 wine 应用程序切换到后台时,是无法响应预设的全局快捷键的,需要借助 xdotool 模拟按键信息发送 wine,通过 xbindkeys 绑定快捷键发送指令,如果使用的桌面环境支持绑定脚本命令,也可使用脚本完成发送。

# 安装xdotool
yay -S xdotool
  1. xbindkeys 绑定快捷键方式
# 安装xbindkeys
yay -S xbindkeys

# 生成默认配置文件
xbindkeys -d > ~/.xbindkeysrc

# 编辑配置文件
vim ~/.xbindkeysrc

添加如下内容,alt + x 通达信开启隐藏的默认快捷键。

# 通达信隐藏  
"xdotool key --window $(xdotool search --limit 1 --all --pid $(pgrep tdxw.exe)) 'alt+x'"  
 alt + x
# 重新启动xbindkeys
killall xbindkeys
xbindkeys
  1. 桌面环境
vim ~/tdxh.sh

添加如下内容

#!/bin/bash
# 通达信
xdotool key --window $(xdotool search --limit 1 --all --pid $(pgrep tdxw.exe)) "alt+x"
# 增加执行权限
chmod +x ~/tdxh.sh

下面是 kde 的快捷键设置方式,打开 设置 -> 快捷键 -> 添加命令 -> 选择 脚本 -> 添加 -> 自定义快捷键 -> 应用

0

评论区