|
|
|
@ -13,6 +13,7 @@ using System.Windows.Input; |
|
|
|
using System.Windows.Media; |
|
|
|
using System.Windows.Media.Imaging; |
|
|
|
using System.Windows.Shapes; |
|
|
|
using System.Runtime.InteropServices; |
|
|
|
|
|
|
|
namespace formula_manage |
|
|
|
{ |
|
|
|
@ -21,7 +22,26 @@ namespace formula_manage |
|
|
|
/// </summary>
|
|
|
|
public partial class Login : Window |
|
|
|
{ |
|
|
|
|
|
|
|
[DllImport("user32.dll", SetLastError = true)] |
|
|
|
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo); |
|
|
|
public static void PressKey(Keys key, bool up) |
|
|
|
{ |
|
|
|
const int KEYEVENTF_EXTENDEDKEY = 0x1; |
|
|
|
const int KEYEVENTF_KEYUP = 0x2; |
|
|
|
if (up) |
|
|
|
{ |
|
|
|
|
|
|
|
keybd_event((byte)key, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (UIntPtr)0); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
|
keybd_event((byte)key, 0x45, KEYEVENTF_EXTENDEDKEY, (UIntPtr)0); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Login() |
|
|
|
{ |
|
|
|
WindowStartupLocation = WindowStartupLocation.CenterScreen; |
|
|
|
@ -59,8 +79,16 @@ namespace formula_manage |
|
|
|
{ |
|
|
|
if (e.Key == Key.Enter) |
|
|
|
{ |
|
|
|
SendKeys.SendWait("{Tab}"); |
|
|
|
//SendKeys.SendWait("{Tab}");
|
|
|
|
PressKey(Keys.Tab, false); |
|
|
|
PressKey(Keys.Tab, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e) |
|
|
|
{ |
|
|
|
PressKey(Keys.Tab, false); |
|
|
|
PressKey(Keys.Tab, true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|