[AHK]获取通达信软件上的股票代码

news/2023/12/6 0:18:16

[AHK]获取通达信软件上的股票代码
https://blog.csdn.net/liuyukuan/article/details/104195901
[AHK]通达信数据导出功能的消息号是33233
https://blog.csdn.net/liuyukuan/article/details/107570616/

PC上的股票交易软件的自动止损、自动下单等功能比较弱,不如期货交易软件。

自力更生,程序员都是自己打造工具。

根据IPO模型(Input 输入,Process处理,Output输出),为了方便自动化首先要获取当前交易软件上浏览的股票代码。

截图再OCR显然太麻烦,通过Winspy工具查看下交易软件自带功能的消息号(33780),大家记住这个号码!

有朋友索要查看消息的ahk工具,代码如下(2021年2月25日更新,只显示当前鼠标下面菜单项的消息号):

用法:下面代码存成独立ahk脚本,运行之。在想要查看消息的程序内,调出该软件的相关菜单,把鼠标移动到某个菜单项上,查看屏幕左上角的tooltip。

;AHK v1.1 x64/x32 compatible update by jeeswg of:
;Get Info from Context Menu - Scripts and Functions - AutoHotkey Community
;https://autohotkey.com/board/topic/19754-get-info-from-context-menu/;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         micha
;
; Script Function:
;	Demonstrates how to retrieve infos from a context/ popup menu
;/*
This is the struct we are using.
typedef struct tagMENUITEMINFO {UINT    cbSize;UINT    fMask;UINT    fType;UINT    fState;UINT    wID;HMENU   hSubMenu;HBITMAP hbmpChecked;HBITMAP hbmpUnchecked;ULONG_PTR dwItemData;LPTSTR  dwTypeData;UINT    cch;HBITMAP hbmpItem;
} MENUITEMINFO, *LPMENUITEMINFO;*/
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#Persistent
RunAsAdmin() 
SetTimer, Demo, 500
return
Demo:
;constants
MFS_ENABLED = 0
MFS_CHECKED = 8
MFS_DEFAULT = 0x1000
MFS_DISABLED = 2
MFS_GRAYED = 1
MFS_HILITE = 0x80
;MFS_UNCHECKED = 0
;MFS_UNHILITE = 0
;Get mouse position and handle to wnd under the mouse cursor
MouseGetPos, MouseScreenX, MouseScreenY, MouseWindowUID, MouseControlID
WinGet,ControlHwnd, ID,ahk_id %MouseWindowUID%
;Get count of menu items
ContextMenCnt := GetContextMenuCount(ControlHwnd)
if ContextMenCnt < 1
{Tooltip,return
}
TooltipText =
;Read info for each menu item
loop, %ContextMenCnt%
{IsEnabled := GetContextMenuState(ControlHwnd, a_index-1){CurrentText =;~ if IsEnabled = 0;~ CurrentText = %CurrentText% Enabled;~ if (IsEnabled & MFS_CHECKED);~ CurrentText = %CurrentText% Checked;~ if (IsEnabled & MFS_DEFAULT);~ CurrentText = %CurrentText% Default;~ if (IsEnabled & MFS_DISABLED);~ CurrentText = %CurrentText% Disabled;~ if (IsEnabled & MFS_GRAYED);~ CurrentText = %CurrentText% Grayed;~ if (IsEnabled & MFS_HILITE);~ CurrentText = %CurrentText% Highlight;~ TooltipText = %TooltipText%%a_index%:%CurrentText%`nif (IsEnabled & MFS_HILITE){CurrentText := GetContextMenuID(ControlHwnd, a_index-1) . A_Tab . GetContextMenuText(ControlHwnd, a_index-1)TooltipText := CurrentText    }}
}
;~ TextText =
;~ loop, %ContextMenCnt%
;~ {;~ StrSize := GetContextMenuText(ControlHwnd, a_index-1);~ nID := GetContextMenuID(ControlHwnd, a_index-1);~ TextText = %TextText%%a_index%:%StrSize%-ID=%nID%`n
;~ }
CoordMode, Tooltip, Screen
Tooltip, %TooltipText%---`n%TextText%, 0, 0
return
/***************************************************************
* returns the count of menu items
***************************************************************
*/
GetContextMenuCount(hWnd)
{WinGetClass, WindowClass, ahk_id %hWnd%;All popups should have the window class #32768if WindowClass <> #32768{return 0}; Retrieve menu handle from windowSendMessage, 0x01E1, , , , ahk_id %hWnd%;Errorlevel is set by SendMessage. It contains the handle to the menuhMenu := errorlevelmenuitemcount:=DllCall("GetMenuItemCount", Ptr,hMenu)Return, menuitemcount
}
/***************************************************************
* returns the state of a menu entry
***************************************************************
*/
GetContextMenuState(hWnd, Position)
{WinGetClass, WindowClass, ahk_id %hWnd%if WindowClass <> #32768{return -1}SendMessage, 0x01E1, , , , ahk_id %hWnd%;Errorlevel is set by SendMessage. It contains the handle to the menuhMenu := errorlevel;We need to allocate a structVarSetCapacity(MenuItemInfo, 60, 0);Set Size of Struct to the first memberNumPut(A_PtrSize=8?80:48, MenuItemInfo, 0, "UInt");Get only Flags from dllcall GetMenuItemInfo MIIM_TYPE = 1NumPut(1, MenuItemInfo, 4, "UInt");GetMenuItemInfo: Handle to Menu, Index of Position, 0=Menu identifier / 1=IndexInfoRes := DllCall("user32.dll\GetMenuItemInfo", Ptr,hMenu, UInt,Position, Int,1, Ptr,&MenuItemInfo)InfoResError := errorlevelLastErrorRes := DllCall("GetLastError", UInt)if InfoResError <> 0return -1if LastErrorRes != 0return -1;Get Flag from structGetMenuItemInfoRes := NumGet(MenuItemInfo, 12, "UInt")/*IsEnabled = 1if GetMenuItemInfoRes > 0IsEnabled = 0return IsEnabled*/return GetMenuItemInfoRes
}
/***************************************************************
* returns the ID of a menu entry
***************************************************************
*/
GetContextMenuID(hWnd, Position)
{WinGetClass, WindowClass, ahk_id %hWnd%if WindowClass <> #32768{return -1}SendMessage, 0x01E1, , , , ahk_id %hWnd%;Errorlevel is set by SendMessage. It contains the handle to the menuhMenu := errorlevel;UINT GetMenuItemID(          HMENU hMenu,    int nPos);InfoRes := DllCall("user32.dll\GetMenuItemID", Ptr,hMenu, Int,Position, UInt)InfoResError := errorlevelLastErrorRes := DllCall("GetLastError", UInt)if InfoResError <> 0return -1if LastErrorRes != 0return -1return InfoRes
}
/***************************************************************
* returns the text of a menu entry (standard windows context menus only!!!)
***************************************************************
*/
GetContextMenuText(hWnd, Position)
{WinGetClass, WindowClass, ahk_id %hWnd%if WindowClass <> #32768{return -1}SendMessage, 0x01E1, , , , ahk_id %hWnd%;Errorlevel is set by SendMessage. It contains the handle to the menuhMenu := errorlevel;We need to allocate a structVarSetCapacity(MenuItemInfo, 200, 0);Set Size of Struct (48) to the first memberNumPut(A_PtrSize=8?80:48, MenuItemInfo, 0, "UInt");Retrieve string MIIM_STRING = 0x40 = 64 (/ MIIM_TYPE = 0x10 = 16)NumPut(64, MenuItemInfo, 4, "UInt");Set type - Get only size of string we need to allocate;NumPut(0, MenuItemInfo, 8, "UInt");GetMenuItemInfo: Handle to Menu, Index of Position, 0=Menu identifier / 1=IndexInfoRes := DllCall("user32.dll\GetMenuItemInfo", Ptr,hMenu, UInt,Position, Int,1, Ptr,&MenuItemInfo)if InfoRes = 0return -1InfoResError := errorlevelLastErrorRes := DllCall("GetLastError", UInt)if InfoResError <> 0return -1if LastErrorRes <> 0return -1;Get size of string from structGetMenuItemInfoRes := NumGet(MenuItemInfo, A_PtrSize=8?64:40, "UInt");If menu is empty returnIf GetMenuItemInfoRes = 0return "{Empty String}";+1 should be enough, we'll use 2GetMenuItemInfoRes += 2;Set capacity of string that will be filled by windowsVarSetCapacity(PopupText, GetMenuItemInfoRes, 0);Set Size plus 0 terminator + security ;-)NumPut(GetMenuItemInfoRes, MenuItemInfo, A_PtrSize=8?64:40, "UInt")NumPut(&PopupText, MenuItemInfo, A_PtrSize=8?56:36, "Ptr")InfoRes := DllCall("user32.dll\GetMenuItemInfo", Ptr,hMenu, UInt,Position, Int,1, Ptr,&MenuItemInfo)if InfoRes = 0return -1InfoResError := errorlevelLastErrorRes := DllCall("GetLastError", UInt)if InfoResError <> 0return -1if LastErrorRes <> 0return -1return PopupText
}
;PrintScreen::reload
RunAsAdmin() {full_command_line := DllCall("GetCommandLine", "str")if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)")){try{if A_IsCompiledRun *RunAs "%A_ScriptFullPath%" /restartelseRun *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"}ExitApp}
}

http://www.ppmy.cn/news/1148404.html

相关文章

基于SpringBoot的大学城水电管理系统

目录 前言 一、技术栈 二、系统功能介绍 管理员模块的实现 领用设备管理 消耗设备管理 设备申请管理 状态汇报管理 用户模块的实现 设备申请 状态汇报 用户反馈 三、核心代码 1、登录模块 2、文件上传模块 3、代码封装 前言 随着信息技术在管理上越来越深入而广泛…

C++函数名与类型

背景 之前一直不明白为什么函数重载不能算上返回值&#xff1a; int test(int); bool test(int);上面这段代码就会在编译出问题&#xff0c;原因是重复定义&#xff0c;但是直观感觉应该很好区分的&#xff0c;为啥编译器不能识别呢&#xff1f; 原因 因为C标准支持下面的…

无人值守配电室变电所运维解决方案

随着电力系统数字化、智能化的不断发展&#xff0c;无人值守配电室变电所已经成为一种趋势。为了确保变电所的安全稳定运行&#xff0c;本文提出了一种无人值守配电室变电所运维解决方案。 一、背景介绍 力安科技电易云无人值守配电室变电所是指通过远程监控和智能化电力数…

记录nacos2.0+使用nginx代理出现的问题

一、问题背景&#xff1a; 在同一台服务器&#xff08;centos7&#xff09;搭建nacos服务集群。部署了3个nacos服务&#xff0c;使用不同的端口8848,8858,8868。 使用nginx代理端口8847映射到nacos端口&#xff0c;如下 upstream nacoscluster {server 127.0.0.1:8848;server…

安道亮相深圳国际全触与显示展,展示最新商显研发成果!

10月11日&#xff0c;2023深圳国际全触与显示展在深圳举行&#xff0c;安道及晟沃携最新智能交互一体机、会议配件等最新商显产品亮相&#xff0c;现场真实智能会议场景&#xff0c;全面展现安道在智慧终端方面的卓越研发实力和创新应用能力&#xff0c;吸引了众多观众前来展台…

JAVA设计模式-装饰者模式

一.概念 装饰器模式(Decorator Pattern)&#xff0c;动态地给一个对象添加一些额外的职责&#xff0c;就增加功能来说&#xff0c;装饰器模式比生成子类更灵活。 —-《大话设计模式》 允许向一个现有的对象添加新的功能&#xff0c;同时又不改变其结构。这种类型的设计模式属…

大数据Doris(八):启动FE步骤

文章目录 启动FE步骤 一、配置环境变量 二、​​​​​​​创建doris-mate

ubuntu 22.04.3 live server图文安装流程

备注&#xff1a;以下操作全用键盘&#xff0c;tab切换&#xff0c;enter确认&#xff0c;方向键移动&#xff1b; 1、 选择安装&#xff0c;第一个&#xff1b; 2、选择语言&#xff0c;这里只能选择英语&#xff0c;无中文&#xff1b; 3、继续而不更新 4、键盘&#xff0c;…

Linux命令(100)之sz

linux命令之sz 1.sz介绍 linux命令sz是用来把文件从Linux平台下载到Windows上 2.sz用法 sz [参数] file sz参数 参数说明-b使用binary的方式下载&#xff0c;不解释字符为ascii-y相同文件名&#xff0c;覆盖-E相同文件名&#xff0c;不会将其覆盖&#xff0c;而是会在所上传…

KUKA机器人如何强制输出或取消数字IO信号?

KUKA机器人如何强制输出或取消数字IO信号? 具体的操作方法和步骤可参考以下内容: 如下图所示,点击菜单—显示—输入/输出端,如下图所示,选择想要查看的信号,这里以数字输出端为例进行说明, 如下图所示,此时可以看到输出端信号的编号、名称和当前值,可以通过下拉滚动条…

Java-集合框架

文章目录 摘要CollectionCollection集合遍历Iterator迭代器增强for循环 排序 ListArrayListLinkedListVector SetHashSet Map遍历KeySetEntrySet迭代器 HashMapHashTableTreeMap 小结 摘要 Java的集合框架提供了一组用于存储、管理和操作数据的类和接口。这个框架提供了各种数…

CRM系统:客户培育提高业绩的方法

多数情况下客户线索不会在首次沟通后就表现出强烈购买的意愿&#xff0c;这期间需要经过不断地沟通和培育才能进入到产品购买阶段。CRM客户管理系统帮助销售挖掘价值客户、高效跟进客户直至成交。下面说说&#xff0c;CRM系统如何客户培育提高业绩。 一、筛选潜在客户 企业客…

安科瑞ARB5系列弧光保护装置,智能电弧光保护,保障用电安全

安科瑞虞佳豪壹捌柒陆壹伍玖玖零玖叁 什么是弧光 电弧是放电过程中发生的一种现象&#xff0c;当两点之间的电压超过其工频绝缘强度极限时就会发生。当适当的条件出现时&#xff0c;一个携带着电流的等离子产生&#xff0c;直到电源侧的保护设备断开才会消失。空气在通常条件…

docker network 组件内网

一、docker network指令详情 以下是一些常用的 Docker 网络管理指令&#xff1a; 列出可用的网络&#xff1a; $ docker network ls 该命令将显示所有可用的 Docker 网络&#xff0c;包括网络 ID、名称、驱动程序和范围等信息。 创建一个网络&#xff1a; $ docker network …

第P9周-YOLOv5Backbone模块

CSP Bottleneck块和C3 类的设计使其非常适合目标检测任务&#xff0c;充分考虑了多尺度特征融合、梯度流动和计算效率等因素。C3 类以及CSP&#xff08;Cross Stage Partial&#xff09; Bottleneck块作为YOLOv5中的一部分&#xff0c;具有以下优势&#xff0c;相对于传统的普通…

shell中实用eval命令和安全问题

eval命令非常强大&#xff0c;但也非常容易被滥用。 它会导致代码被解析两次而不是一次。这意味着&#xff0c;如果你的代码中包含变量引用&#xff0c;shell解析器将评估该变量的内容。如果变量包含一个shell命令&#xff0c;shell可能会运行该命令&#xff0c;无论你是否希望…

使用pymodbus进行modbus-TCP通信

模拟modbus-slave 创建slave 设置 完成 安装pymodbus pip3 install pymodbus2.5.3代码 from pymodbus.client.sync import ModbusTcpClient from pymodbus.bit_read_message import ReadCoilsResponse from pymodbus.register_read_message import ReadInputRegistersRe…

[SRT]1.协议简介

1.简介 ​ 安全可靠传输协议(Secure Reliable Transport)简称SRT&#xff0c;是一种基于UDT协议的开源互联网传输协议&#xff0c;Haivision和Wowza合作成立SRT联盟&#xff0c;管理和支持SRT协议开源应用的组织&#xff0c;这个组织致力于促进视频流解决方案的互通性&a…

优盘无法格式化?分享简单解决方法!

“我的优盘插入了一个带病毒的电脑中&#xff0c;现在优盘也中毒了&#xff0c;想把它格式化。但是操作的时候却显示优盘无法格式化&#xff0c;这种情况应该怎么办呢&#xff1f;” 优盘&#xff0c;又称USB闪存驱动器。由于其体积小且方便携带&#xff0c;受到广大电脑用户的…

记一次生产大对象及GC时长优化经验

最近在做一次系统整体优化,发现系统存在GC时长过长及JVM内存溢出的问题,记录一下优化的过程 面试的时候我们都被问过如何处理生产问题&#xff0c;尤其是线上oom或者GC调优的问题更是必问&#xff0c;所以到底应该如何发现解决这些问题呢&#xff0c;用真实的场景实操&#xff…
最新文章