Betty
Thu May 08 05:21:00 CDT 2008
/*The following two lines of codes cannot work correctly too.*/
SendMessage(handle, 0x0101, (IntPtr)0x61, (IntPtr)0);
SendMessage(handle, 0x0102, (IntPtr)0x61, (IntPtr)0);
"Betty" wrote:
> Hi Jeffrey,
> I've read your following comments and wrote some codes (C#). But they don't
> work correctly. Please have a look. Thank you a lot.
>
> [DllImport("User32.dll")]
> internal static extern Int32 SendMessage(IntPtr hWnd, int Msg, IntPtr
> wParam, IntPtr lParam);
> /*handle is present an edit box. I want to use SendMessage to type a char
> into this edit, but nothing is input into it.*/
> SendMessage(handle, 0x0100, (IntPtr)0x61, (IntPtr)0);
>
>
> ""Jeffrey Tan[MSFT]"" wrote:
>
> > Hi Berni,
> >
> > I am not familiar with the german keyboard, so it is hard for me say the
> > root cause without reproducing the problem. Is it possible that only "^" is
> > translated into "&" on german keyboard?
> >
> > Actually, using SendKeys.Send is not operating the on-screen keyboard, it
> > is sending keystrokes through the real keyboard input queue, so it will be
> > affected by the real keyboard settings instead of the on-screen keyboard.
> > That's why MSDN placed a "Caution" for SendKeys.Send() method.
> >
> > Can you help to explain what you want to achieve? Maybe we have other
> > solution to workaround this problem. If you just want to send characters to
> > a TextBox in an application(or your own application), the simplest solution
> > is calling SendMessage(WM_CHAR) to that control/window. In the "wParam" of
> > SendMessage API, we may specify the character ASCII code. For example, we
> > may specify 94(0x5E) for "wParam" for "^" character. The link below
> > contains the ASCII character table:
> > "ASCII Character Codes Chart 1"
> >
http://msdn.microsoft.com/en-us/library/60ecse8t.aspx
> >
> > Actually, even we are using SendKeys.Send, the target application will just
> > receive a WM_LBUTTONDOWN message for the real keyboard button, which will
> > finally be translated into WM_CHAR by Winform/Win32 code. So, using WM_CHAR
> > is a more straightforward solution.
> >
> > If you want to take this approach and need further help, please feel free
> > to tell me, thanks.
> >
> > Best regards,
> > Jeffrey Tan
> > Microsoft Online Community Support
> >
> > 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/subscriptions/managednewsgroups/default.aspx#notif
> > ications.
> >
> > 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://msdn.microsoft.com/subscriptions/support/default.aspx.
> > ==================================================
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >
> >