Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Thu, 10 Jul 2008 17:03:15 -0700,    group: microsoft.public.win32.programmer.gdi        back       


Sending keyboard inputs to combobox   
I am trying to create a on screen key board.
I simply want to send a key (Simulate the keyboard) to a combo box using the Handle of the control.

The below code is not working

   public const ushort WM_KEYDOWN = 0x0100;
        public const ushort WM_KEYUP = 0x0101;

        //Set the active window
        [DllImport("user32.dll")]
        public static extern IntPtr SetActiveWindow(IntPtr hWnd);

        //sends a windows message to the specified window
        [DllImport("user32.dll")]
        public static extern int SendMessage(IntPtr hWnd, int Msg, uint wParam, int lParam);


        
        

        public void SendKey(ushort key, IntPtr hWnd)
        {
        SetActiveWindow(hWnd);
      //  Control c = this.ActiveControl;
      //  MessageBox.Show(c.Name.ToString());
        SendMessage(hWnd, WM_KEYDOWN, key, 0);
     //    c = this.ActiveControl;
      //   MessageBox.Show(c.Name.ToString());
     //   SendMessage(hWnd, 0, key, 0);
         SendMessage(hWnd.Handle, WM_KEYUP, key, 0);
        }



        #endregion

        private void button3_Click(object sender, EventArgs e)
        {
            
            SendKey((int)Keys.A, comboBox1.Handle);
        }


I have tested  SendKeys, Key_evnt and sendinput, they don't satisfy what is needed.

Thanks,
date: Thu, 10 Jul 2008 17:03:15 -0700   author:   John Dio

Sending keyboard inputs to combobox   
Sorry I am new to this forum , wanted to post it under C#. As this is the language I am using. Don't know how to delete it now.

My Appologies.
date: Thu, 10 Jul 2008 17:08:41 -0700   author:   John Dio

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us