看板 C_and_CPP 關於我們 聯絡資訊
我有參考別人的程式碼弄成功了,給需要的參考看看 以下為程式碼 void __fastcall TForm1::Button1Click(TObject *Sender) { ShellExecute(Handle,"open","c:\\a.pdf",NULL,NULL,SW_MAXIMIZE); Sleep(1000); HWND LastEditHandle = ::GetForegroundWindow(); AttachThreadInput(GetCurrentThreadId(), GetWindowThreadProcessId (LastEditHandle, NULL), true); HWND hFocusWin = GetFocus(); AttachThreadInput(GetCurrentThreadId(), GetWindowThreadProcessId (LastEditHandle, NULL), false); int i; Byte ch; AnsiString str = "參考看看"; for( i = 1; i <= str.Length(); i++ ) { ch = Byte(str[i]); if( IsDBCSLeadByte(ch) ) PostMessage(hFocusWin, WM_IME_CHAR, MAKEWORD(Byte(str[++i]), ch), 0); else PostMessage(hFocusWin, WM_IME_CHAR, WORD(ch), 0); } } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.207.32