Converter API do Windows
Enviado: 19 Abr 2021 14:16
Tem uma função da API do Windows chamada SendInput, só que não sei como converter ela pra Harbour.
Estou usando Harbour MiniGUI Extended Edition 21.03 (Update 2)
SINTAXE em C++
==============
PARAMETROS
===========
RETORNO
========
EXEMPLO
========
REQUERIMENTOS
==============
Queria saber como faz, ou se existe algum artigo que ensina a fazer essa conversão.
Estou usando Harbour MiniGUI Extended Edition 21.03 (Update 2)
SINTAXE em C++
==============
Código: Selecionar todos
UINT SendInput(
UINT cInputs,
LPINPUT pInputs,
int cbSize
);
===========
Código: Selecionar todos
cInputs
Type: UINT
The number of structures in the pInputs array.
pInputs
Type: LPINPUT
An array of INPUT structures. Each structure represents an event to be inserted into the keyboard or mouse input stream.
cbSize
Type: int
The size, in bytes, of an INPUT structure. If cbSize is not the size of an INPUT structure, the function fails.
========
Código: Selecionar todos
Type: UINT
The function returns the number of events that it successfully inserted into the keyboard or mouse input stream. If the function returns zero, the input was already blocked by another thread. To get extended error information, call GetLastError.
This function fails when it is blocked by UIPI. Note that neither GetLastError nor the return value will indicate the failure was caused by UIPI blocking.
========
Código: Selecionar todos
//**********************************************************************
//
// Sends Win + D to toggle to the desktop
//
//**********************************************************************
void ShowDesktop()
{
OutputString(L"Sending 'Win-D'\r\n");
INPUT inputs[4];
ZeroMemory(inputs, sizeof(inputs));
inputs[0].type = INPUT_KEYBOARD;
inputs[0].ki.wVk = VK_LWIN;
inputs[1].type = INPUT_KEYBOARD;
inputs[1].ki.wVk = VK_D;
inputs[2].type = INPUT_KEYBOARD;
inputs[2].ki.wVk = VK_D;
inputs[2].ki.dwFlags = KEYEVENTF_KEYUP;
inputs[3].type = INPUT_KEYBOARD;
inputs[3].ki.wVk = VK_LWIN;
inputs[3].ki.dwFlags = KEYEVENTF_KEYUP;
UINT uSent = SendInput(ARRAYSIZE(inputs), inputs, sizeof(INPUT));
if (uSent != ARRAYSIZE(inputs))
{
OutputString(L"SendInput failed: 0x%x\n", HRESULT_FROM_WIN32(GetLastError()));
}
}
==============
Código: Selecionar todos
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll