我有下面的代码,我试图从活动窗口中获取选定的文本并将其打印到控制台上。
DWORD new12=0;
KEYBDINPUT* input = new KEYBDINPUT[key_count];
if( GetGUIThreadInfo( new12, lpgui ) )
{
target_window = lpgui->hwndFocus;
}
else
{
// You can get more information on why the function failed by calling
// the win32 function, GetLastError().
std::cout<<"error1";
}
// We're sending two keys CONTROL and 'V'. Since keydown and keyup are two
// seperate messages, we multiply that number by two.
for( int i = 0; i < key_count; i++ )
{
input[i].dwFlags = 0;
//input[i].type = INPUT_KEYBOARD;
}
input[0].wVk = VK_CONTROL;
input[0].wScan = MapVirtualKey( VK_CONTROL, MAPVK_VK_TO_VSC );
input[1].wVk = 0x56; // Virtual key code for 'v'
input[1].wScan = MapVirtualKey( 0x56, MAPVK_VK_TO_VSC );
我有上面的 c++ 代码,但它似乎给出了一个错误,说“ error: MAPVK_VK_TO_VSC' was not declared in this scope
”在input[0].wScan = MapVirtualKey( VK_CONTROL, MAPVK_VK_TO_VSC );
我想知道这里有什么问题。我不认为由于任何声明问题而弹出此错误。你能帮帮我吗?谢谢你。