powered by simpleCommunicator - 2.0.36     © 2025 Programmizd 02
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / SendInput for 64 bit
2 сообщений из 2, страница 1 из 1
SendInput for 64 bit
    #40031169
HOME_X
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Доброго дня господа !

Необходимо 32-bit тип привести к 64 bit
Никак не пойму ошибку

Исходник
Код: vbnet
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
Const VK_H = 72
Const VK_E = 69
Const VK_L = 76
Const VK_O = 79
Const VK_ENTER = &HD
Const KEYEVENTF_KEYUP = &H2
Const INPUT_MOUSE = 0
Const INPUT_KEYBOARD = 1
Const INPUT_HARDWARE = 2

Private Type MOUSEINPUT
  dx As Long
  dy As Long
  mouseData As Long
  dwFlags As Long
  time As Long
  dwExtraInfo As Long
End Type

Private Type KEYBDINPUT
  wVk As Integer
  wScan As Integer
  dwFlags As Long
  time As Long
  dwExtraInfo As Long
End Type

Private Type HARDWAREINPUT
  uMsg As Long
  wParamL As Integer
  wParamH As Integer
End Type

Private Type GENERALINPUT
  dwType As Long
  xi(0 To 23) As Byte
End Type

Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Long, pInputs As GENERALINPUT, ByVal cbSize As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Sub Test()
  Shell "NotePad.EXE", 1
  SendKey VK_H
  SendKey VK_E
  SendKey VK_L
  SendKey VK_L
  SendKey VK_O
  SendKey VK_ENTER
  SendKey VK_H
  SendKey VK_E
  SendKey VK_L
  SendKey VK_L
  SendKey VK_O
End Sub
Private Sub SendKey(bKey As Byte)
  Dim GInput(0 To 1) As GENERALINPUT
  Dim KInput As KEYBDINPUT
  KInput.wVk = bKey  'the key we're going to press
  KInput.dwFlags = 0 'press the key
  'copy the structure into the input array's buffer.
  GInput(0).dwType = INPUT_KEYBOARD   ' keyboard input hello
  CopyMemory GInput(0).xi(0), KInput, Len(KInput)
  'do the same as above, but for releasing the key
  KInput.wVk = bKey  ' the key we're going to realease
  KInput.dwFlags = KEYEVENTF_KEYUP  ' release the key
  GInput(1).dwType = INPUT_KEYBOARD  ' keyboard input
  CopyMemory GInput(1).xi(0), KInput, Len(KInput)
  'send the input now
  Call SendInput(2, GInput(0), Len(GInput(0)))
End Sub



Преобразовал
Код: vbnet
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
Const VK_H = 72
Const VK_E = 69
Const VK_L = 76
Const VK_O = 79
Const VK_ENTER = &HD
Const KEYEVENTF_KEYUP = &H2
Const INPUT_MOUSE = 0
Const INPUT_KEYBOARD = 1
Const INPUT_HARDWARE = 2

Private Type MOUSEINPUT
  dx As Long
  dy As Long
  mouseData As Long
  dwFlags As Long
  time As Long
  dwExtraInfo As LongPtr
End Type

Private Type KEYBDINPUT
  wVk As Integer
  wScan As Integer
  dwFlags As Long
  time As Long
  dwExtraInfo As LongPtr
End Type

Private Type HARDWAREINPUT
  uMsg As Long
  wParamL As Integer
  wParamH As Integer
End Type

Private Type GENERALINPUT
  dwType As Long
  xi(0 To 31) As Byte '+8
End Type

Private Declare PtrSafe Function SendInput Lib "user32.dll" (ByVal nInputs As Long, pInputs As GENERALINPUT, ByVal cbSize As Long) As LongPtr
Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Sub Test()
  Shell "NotePad.EXE", 1
  SendKey VK_H
  SendKey VK_E
  SendKey VK_L
  SendKey VK_L
  SendKey VK_O
  SendKey VK_ENTER
  SendKey VK_H
  SendKey VK_E
  SendKey VK_L
  SendKey VK_L
  SendKey VK_O
End Sub
Private Sub SendKey(bKey As Byte)
  Dim GInput(0 To 1) As GENERALINPUT
  Dim KInput As KEYBDINPUT
  KInput.wVk = bKey  'the key we're going to press
  KInput.dwFlags = 0 'press the key
  'copy the structure into the input array's buffer.
  GInput(0).dwType = INPUT_KEYBOARD   ' keyboard input hello
  CopyMemory GInput(0).xi(0), KInput, Len(KInput)
  'do the same as above, but for releasing the key
  KInput.wVk = bKey  ' the key we're going to realease
  KInput.dwFlags = KEYEVENTF_KEYUP  ' release the key
  GInput(1).dwType = INPUT_KEYBOARD  ' keyboard input
  CopyMemory GInput(1).xi(0), KInput, Len(KInput)
  'send the input now
  Call SendInput(2, GInput(0), Len(GInput(0)))
End Sub



Подскажите пожалуйста что не так
...
Рейтинг: 0 / 0
SendInput for 64 bit
    #40032656
HOME_X
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
HOME_X,

Тема решена - вопрос закрыт всем спасибо
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / Visual Basic [игнор отключен] [закрыт для гостей] / SendInput for 64 bit
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]