看来很多人有这个要求,5.5至今已有3人提出。但问题好象很难解决。<br>可以肯定,用API的方式在Windows98是行不通的。<br>在WIndows NT 下应该是可以实现的。但是,我试过N次,都fail.<br><br>其一:<br>var <br>HDesk_WL: HDESK; <br>begin <br>HDesk_WL := OpenDesktop ('Winlogon', 0, False, DESKTOP_JOURNALPLAYBACK); <br>if (HDesk_WL <> 0) then <br>begin <br>{we have open the Winlogon Desktop so assign it to our thread} <br>if (SetThreadDesktop (HDesk_WL) = True) then <br>begin <br>// Winlogon uses hotkeys to trap Ctrl-Alt-Del... <br>PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG (MOD_ALT or MOD_CONTROL, VK_DELETE));<br>end<br>end<br>end;<br><br>其二:<br><br><br> SK_DEL = #249;<br> SK_SHIFT_DN = #250;<br> SK_SHIFT_UP = #251;<br> SK_CTRL_DN = #252;<br> SK_CTRL_UP = #253;<br> SK_ALT_DN = #254;<br> SK_ALT_UP = #255;<br><br>procedure SendKeyString(Text: String);<br>var<br> i: Integer;<br> Shift: Boolean;<br> vk, ScanCode: Word;<br> ch: Char;<br> c, s: Byte;<br>const<br> vk_keys: Array[0..9] of Byte =<br> (VK_HOME, VK_END, VK_UP, VK_DOWN, VK_LEFT,<br> VK_RIGHT, VK_PRIOR, VK_NEXT, VK_INSERT, VK_DELETE);<br> vk_shft: Array[0..2] of Byte = (VK_SHIFT, VK_CONTROL, VK_MENU);<br> flags: Array[False..True] of Integer = (KEYEVENTF_KEYUP, 0);<br>begin<br> Shift := False;<br> for i := 1 to Length(Text) do<br> begin<br> ch := Text;<br> if ch >= #250 then<br> begin<br> s := Ord(ch) - 250;<br> Shift := not Odd(s);<br> c := vk_shft[s shr 1];<br> ScanCode := MapVirtualKey(c,0);<br> Keybd_Event(c, Scancode, Flags[shift], 0);<br> end<br> else<br> begin<br> vk := 0;<br> if ch >= #240 then<br> c := vk_keys[Ord(ch) - 240]<br> else<br> if ch >= #228 then {228 (F1) => $70 (vk_F1)}<br> c := Ord(ch) - 116<br> else<br> if ch < #110 then<br> c := Ord(ch)<br> else<br> begin<br> vk := VkKeyScan(ch);<br> c := LoByte(vk);<br> end;<br> ScanCode := MapVirtualKey(c,0);<br> if not Shift and (Hi(vk) > 0) then { $2A = scancode of VK_SHIFT }<br> Keybd_Event(VK_SHIFT, $2A, 0, 0);<br> Keybd_Event(c,scancode, 0, 0);<br> Keybd_Event(c,scancode, KEYEVENTF_KEYUP, 0);<br> if not Shift and (Hi(vk) > 0) then<br> Keybd_Event(VK_SHIFT, $2A, KEYEVENTF_KEYUP, 0);<br> end;<br> end;<br>end;<br><br>procedure SendKeysToHandle(WindowHandle: hWnd; Text: String);<br>begin<br> MakeWindowActive(WindowHandle);<br> SendKeyString(Text);<br>end;<br><br>执行:SendKeysToHandle(HWAND_BROACAST,SK_CTRL_DN + SK_Alt_DN + SK_DEL )<br>fail ?!!!!<br><br>why ???