我想在一网页中的文本框中自动输入一字符串!请教!谢谢!!

解决方案 »

  1.   

    VOID keybd_event(    BYTE bVk, // virtual-key code
        BYTE bScan, // hardware scan code
        DWORD dwFlags, // flags specifying various function options
        DWORD dwExtraInfo  // additional data associated with keystroke
       );
      

  2.   

    keybd_event(13, 0, 0, 0 );模拟发送回车键。
                ^^回车的键值
      

  3.   

    Sorry!
    没看请楼主的意思,我的代码是在普通程序里模拟输入的,在网页中模拟输入不太好解决。
      

  4.   

    这是MSDN里的:
    #include <windows.h>   void SetNumLock( BOOL bState )
       {
          BYTE keyState[256];      GetKeyboardState((LPBYTE)&keyState);
          if( (bState && !(keyState[VK_NUMLOCK] & 1)) ||
              (!bState && (keyState[VK_NUMLOCK] & 1)) )
          {
          // Simulate a key press
             keybd_event( VK_NUMLOCK,
                          0x45,
                          KEYEVENTF_EXTENDEDKEY | 0,
                          0 );      // Simulate a key release
             keybd_event( VK_NUMLOCK,
                          0x45,
                          KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
                          0);
          }
       }   void main()
       {
          SetNumLock( TRUE );
       }但还说明了,这个现在已经被SendInput替代了:
    Windows NT/2000/XP:This function has been superseded. Use SendInput instead.地址长了点:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardInput/KeyboardInputReference/KeyboardInputFunctions/keybd_event.asp
      

  5.   

    回复人: wwwwjjjj1978(风流小太狼) ( ) 信誉:93  2004-01-17 16:29:00  得分:0 
     
     
      请人代输!!呵呵
    ______________________________________________  
     
    哈哈哈哈,,最好找个小妹帮你输。帮你UP一下,其实我也很想知道。