

Those are the Declarations and Types in a recent project of mine - they work and have been tested. If anyone have any solution, I would be really aprreciate.
#VBA INTEGER OVERFLOW CODE#
All the code I found in the internet, include in stack exchange ( SendInput VB Basic Example) won't work.

However when it comes to run the SUB Ctrl_H(), it seems that it cant be run even enormous the amount of work I put in.
#VBA INTEGER OVERFLOW WINDOWS#
So when I run the code, it found the Chrome windows easily. Private Type INPUT_ ' typedef struct tagINPUT INPUT, *PINPUT ĭwPadding As Currency ' 8 extra bytes, because mouses take more.Ĭall SendInput(4, keyInput(0), sizeINPUT) Private Const KEYEVENTF_KEYUP As Long = 2 Private Const VK_PRINTSCREEN As Long = &H2C Private Const VK_CONTROL As Long = &H11 'CTRL

Private Const WM_SYSKEYUP As Long = &H105 Private Const WM_SYSKEYDOWN As Long = &H104 Private Declare PtrSafe Function SendInput Lib "user32" ( _ Public Declare PtrSafe Sub Sleep Lib "kernel32" _ "GetWindowTextLengthA" (ByVal hWnd As LongPtr) As Long Private Declare PtrSafe Function GetWindowTextLength Lib "user32" Alias _ Private Declare PtrSafe Function GetForegroundWindow Lib "user32" () As LongPtr "GetWindowTextA" (ByVal hWnd As LongPtr, ByVal lpWindowText As String, ByVal nMaxCount As LongPtr) As Long Private Declare PtrSafe Function GetWindowText Lib "user32" Alias _ (ByVal hWnd As LongPtr, ByVal lpEnumFunc As LongPtr, ByVal lParam As LongPtr) As Long Private Declare PtrSafe Function EnumChildWindows Lib "user32" _ (ByVal hWnd As LongPtr, ByVal wCmd As Long) As LongPtr Private Declare PtrSafe Function GetWindow Lib "user32" _

(ByVal hWnd As LongPtr, ByVal nIndex As Long) As LongPtr Private Declare PtrSafe Function GetWindowLongPtr Lib "user32" Alias "GetWindowLongPtrA" _ (ByVal hWnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, lParam As Any) As LongPtr Private Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" _ Private Declare PtrSafe Function SetForegroundWindow Lib "user32" _ (ByVal hWnd As LongPtr, ByVal nCmdShow As Long) As Boolean Private Declare PtrSafe Function ShowWindow Lib "user32" _ (ByVal hWnd As LongPtr, ByVal hWndChild As LongPtr, _īyVal lpszClass As String, ByVal lpszWindow As String) As LongPtr Private Declare PtrSafe Function FindWindowEx Lib "user32" Alias "FindWindowExA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" _ So after read the documentation and google search, I reach to this code Option Explicit On the other hand, the SendKeys method in VBA is said to be unreliable. I choose sendinput() because sendmessage would not allow me to send a combination of key at the same time, the window will receive them seperately. I want to use Sendinput function of Windows API in VBA to send a combination of keystrokes to a window, for example Ctrl H to Chrome.
