⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wpw_wapi_kb_95.html

📁 VC programing
💻 HTML
字号:
<HTML>
<HR><A NAME=WINAPI_KB_ALT_TAB>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: Handle Alt+Tab Key</H4><PRE>
F.HEINE@BIONIC.zer.de (Felix Heine) wrote:

> jev@echelon.win-uk.net (Javon Prince) schrieb unter 'Alt+Tab Switching':

> > Does anyone know how to disable Alt+Tab switching?

> Try to handle the WM_SYSKEYDOWN message, filtering ALT+TAB.

> Bye, Felix

This would probably not work. You need to set a system hook with
SetWindowsHookEx, and trap all the events that can result in task
switching.  You would also want to handle Ctrl+Esc and double-clicking
on the desktop, which bring up the Task List dialog.

<HR>
In article <3sa2vj$bn9@distrib.jriver.COM>, bkvam@drake.prometric.com says...
>
>F.HEINE@BIONIC.zer.de (Felix Heine) wrote:
>
>> jev@echelon.win-uk.net (Javon Prince) schrieb unter 'Alt+Tab Switching':
>
>> > Does anyone know how to disable Alt+Tab switching?
>
>> Try to handle the WM_SYSKEYDOWN message, filtering ALT+TAB.
>
>> Bye, Felix
>
>This would probably not work. You need to set a system hook with
>SetWindowsHookEx, and trap all the events that can result in task
>switching.  You would also want to handle Ctrl+Esc and double-clicking
>on the desktop, which bring up the Task List dialog.
>

I have had a great deal of success with the following code (in bp7.0 but it should translate 
easily concept wise to C )

Procedure TPassword.WMSysCommand(Var Msg : TMessage);

Begin
  With Msg Do
  Begin
    Case (WParam And $fff0) Of
      sc_TaskList         : Result := 0;
      sc_NextWindow       : Result := 0;
      sc_PrevWindow       : Result := 0;
    Else
      DefWndProc(Msg);
    End;
  End;
End;



-- 
               .----------------------------------------------------------.
 _             | Clinton R. Johnson  / The Lost Wanderer, Xepol           |
/ |  /          >-------------------------------.                         |
  .|'          | cjohnso1@freenet.calgary.ab.ca | Looking for roadkill on |
 /  |_/ epol   | crjohnson@rain.gen.mo.us       | the Information Highway |
               | xepol@canuck.com               |                         |
                `-------------------------------'`------------------------'

<HR>
This issue has been addressed alot lately, it seems.  I'm running NT, and using
VC 2.0.  One approach which did NOT work for me was someone suggested handling
WM_SYSCOMMAND and filtering out SC_NEXTWINDOW, SC_PREVWINDOW, and SC_TASKLIST.
(for getting ctl-esc, also).  This absolutely did NOT work under NT.

Petzold (for win 3.1 of course) suggests grabbing WM_SYSKEYDOWN, WM_SYSCHAR,
etc.  Also a complete flop under NT.

I have seen mention of a "System Accelerator Table" which acts on keys before
they ever get to the application's accelerator tables.  Is there a way to
selectively disable translation of alt-tab in this system accelerator table?

Also, the online help would lead one to believe that Using SetWindowsHookEx
and just capturing your window's messages, using the message filter callback (
or something like that) would be enough to grab ALT-TAB.  Now, I compiled the
hooks example in the win32 samples directory, and ever THEIR example code did
not trap alt-tab where it claimed it did.

The one thing I haven't tried is the DLL SetWindowsEx Approach to trap all
system message traffic.  It seems pretty promising, but I've had such a lack of
success with all of the other "tried and true" methods that I didn't want to
waste any more time (outside of posting long, whiny followups :-) ).

SO, the $64 (or ~48 pounds sterling, as I could use some help from the UK also, 
if available) is this:  WHAT absolutelt, positively works for disabling alt-tab
for windows NT applications in the VC 2.0, MFC 3.0 environment?

Thanks, 
Dave

moore@picard.jmb.bah.com
</PRE>

<HR><A NAME=WINAPI_KB_SEND_KEYBOARD_EVENT>
Return to <a href="wpw_wapi_index.html#TOC">Table of Contents for this chapter</a><br>
<H4>Subject: How to send keyboard/mouse event to other apps?</H4><PRE>
Yoshiyuki Tanaka (tana@sofia.ksp.fujixerox.co.jp) wrote:

: Is it possible to write a program that catches the mouse and keyboard
: events before it reaches another running application?

: Is it possible to write a program which sends keyboard and mouse
: events to another running program and control it in that way?

: If it is, could someone give me hints. I'm using VC++ and am
: programming for Win3.1 and NT3.5.

Take a look at HOOKS in Microsoft's Win32 Programmer's Reference Volume 1

>Is it possible to write a program that catches the mouse and keyboard
>events before it reaches another running application?
>
>Is it possible to write a program which sends keyboard and mouse
>events to another running program and control it in that way?
>

<HR>

There is an example of a keyboard capture program located on the 
Microsoft Developer CD Number 6 called sendkey. This may be of
some help.

/-----------------------------------------------------------------------/
/- Jussi Jumppanen   "To Brief or not to Brief? There is no question!" -/
/- jussi@sydney.dialix.oz.au                                           -/
/-----------------------------------------------------------------------/
/- Author of: Zeus for Windows 1.04 Ultimate Programmers Editor        -/
/-           (Zeus for Windows 95 on its way)                          -/
/-                                                                     -/
/- garbo.uwasa.fi :/windows/editor/zeusv104.zip                        -/
/- oak.oakland.edu/SimTel/win3/editor/zeusv104.zip                     -/
/-----------------------------------------------------------------------/
</PRE>
 

</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -