some directinput tests

This commit is contained in:
2023-05-07 09:01:23 +02:00
parent 45d3a59416
commit d806ecf947
2 changed files with 60 additions and 0 deletions

View File

@@ -1,6 +1,15 @@
from src import sendkeys
from src import config
from src import data
import win32api
import win32gui
import win32con
from time import sleep
def test_send_direct():
config.read_config(r'config.yaml')
sendkeys.send_directInput('Hello World')
def test_sendkeys():
@@ -74,3 +83,20 @@ def test_ty_wo_trade():
text = '2021/03/08 23:24:52 17931875 bb3 [INFO Client 1492] @From Sinusal: Hi, how are you doing? '
message = data.Message.from_text(text)
sendkeys.send_to_format('ty', message)
def test_win31_api():
hwndMain = win32gui.FindWindow(None, "cmd")
hwndChild = win32gui.GetWindow(hwndMain, win32con.GW_CHILD)
while(True):
# [hwndChild] this is the Unique ID of the sub/child application/proccess
# [win32con.WM_CHAR] This sets what PostMessage Expects for input theres KeyDown and KeyUp as well
# [0x44] hex code for D
# [0]No clue, good luck!
# temp = win32api.PostMessage(hwndChild, win32con.WM_CHAR, 0x44, 0) returns key sent
temp = win32api.PostMessage(hwndChild, win32con.WM_CHAR, 0x44, 0)
# print(temp) prints the returned value of temp, into the console
print(temp)
# sleep(1) this waits 1 second before looping through again
sleep(1)