Programming/C,C++,C#
C#.NET 으로 전역후킹 프로그램 만들때 주의사항..(WH_GETMESSAGE)
smok95
2008. 12. 12. 00:31
반응형
#으로 전역후킹 프로그램을 구현하시려는 분이 계시면..
는 지원이 되지 않는다는 점을 꼭 숙지 하시기 바랍니다.
이걸로 한 3일은 삽질을 했습니다..
아래는 관련 내용입니다.
Dear Alex,
As far as I know to globally the unicode characters, we have to
the WM_IME_COMPOSITION message, but as explained in this KB article:
How to set a Windows in Visual # .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;318804
"
Except for the WH_KEYBOARD_LL low-level and the WH_MOUSE_LL low-level
, you cannot implement hooks in the Microsoft .NET Framework. To
install a , a must have a native DLL export to inject
itself in another process that requires a valid, consistent function to
call into. This behavior requires a DLL export. The .NET Framework does not
support DLL exports. Managed code has no concept of a consistent value for
a function pointer because these function pointers are proxies that are
built dynamically.
"
We can only perform the WH_KEYBOARD_LL and WH_MOUSE_LL low-level in
the # Windows application, the type is not supported in
the .NET Framework.
So, I think we cannot globally the unicode characters in a # Windows
application. Instead, we can create a separate DLL module, and perform the
to trap the WM_IME_COMPOSITION message. Once the
WM_IME_COMPOSITION message is trapped, we can call the
ImmGetCompositionString API to retrieve the unicode characters.
For more information about the hooks and WM_IME_COMPOSITION message,
you can refer to:
Hooks and DLLs
http://www.codeproject.com/KB/DLL/hooks.aspx
WM_IME_COMPOSITION
http://msdn.microsoft.com/en-us/library/ms776172.aspx
ImmGetCompositionString function
http://msdn.microsoft.com/en-us/library/ms776186.aspx
Sincerely,
Zhi-Xin Ye
Microsoft Managed Newsgroup Support Team
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
반응형