VS 快捷键[转]
C# 漫画打包小工具

英语视听说抄答案的小工具

scturtle posted @ 2009年12月18日 16:13 in Other , 2329 阅读

算是第一个MFC程序了,初学,看人家用Java写的一个甚好用,就练手试试

功能也就是模拟键盘按键,把网上的答案输入视听说里

可惜的是下学期没得用了......

图片:

有用的代码:

void CkeydemoDlg::OnBnClickedButton1()
{


	CString str;
	GetDlgItem(IDC_EDIT1)->GetWindowText(str);

	//CString   tmp;  
	//tmp.Format(_T("%d %d"),str.GetLength(),str.GetAt(0));
	MessageBox(_T("Ready? for 3s..."),_T(""),MB_OK|MB_ICONINFORMATION);

	Sleep(3000);

	int shl;//调整ASCII值到虚拟键值
	bool hasTAB=false;//多个无义字符只输出一个TAB

	for(int i=0;i<str.GetLength();++i)
	{
		WORD temp=str.GetAt(i);
		if(temp==39 || temp==8217)// '或‘
		{
			keybd_event(VK_OEM_7,0,0,0);
			keybd_event(VK_OEM_7,0,KEYEVENTF_KEYUP,0);
			continue;
		}
		if(temp>=97 && temp<=122) {shl=32;hasTAB=false;}//小写字母
		else if(temp>=65 && temp<=90) {shl=0;hasTAB=false;}//大写字母
		else
		{
			if(!hasTAB)
			{
				keybd_event(VK_TAB,0,0,0);
				keybd_event(VK_TAB,0,KEYEVENTF_KEYUP,0);
				hasTAB=true;
			}
			continue;
		}
		if(shl==0) keybd_event(VK_SHIFT,0,0,0);

		keybd_event(temp-shl,0,0,0);
		keybd_event(temp-shl,0,KEYEVENTF_KEYUP,0);

		if(shl==0) keybd_event(VK_SHIFT,0,KEYEVENTF_KEYUP,0);
	}
}

 

 


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter