using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
[DllImport("user32.dll")]
private static extern Int32 GetForegroundWindow();
[DllImport("user32.dll")]
private static extern Int32 GetWindowText(Int32 hWnd, StringBuilder lpsb, Int32 count);
public Form1()
{
InitializeComponent();
Timer mytimer = new Timer();
mytimer.Tick += new EventHandler(mytimer_Tick);
mytimer.Start();
/*
// Create a TextBox control.
TextBox tb = new TextBox();
this.Controls.Add(tb);
//將此改為windows視窗物件
//https://msdn.microsoft.com/zh-tw/library/system.windows.window(v=vs.110).aspx
tb.KeyPress += new KeyPressEventHandler(keypressed);
*/
}
private void keypressed(Object o, KeyPressEventArgs e)
{
//判斷按鍵的 Keychar
char Key_Char = e.KeyChar;
// MessageBox.Show(((int)(Key_Char)).ToString());
MessageBox.Show(((Key_Char)).ToString());
}
private void button1_Click(object sender, EventArgs e)
{
Timer mytimer = new Timer();
mytimer.Tick += new EventHandler(mytimer_Tick);
mytimer.Start();
}
private void mytimer_Tick(object sender, EventArgs e)
{
GetCurrentWindow();//取得活動視窗
}
private void GetCurrentWindow()
{
Int32 handle = 0;
StringBuilder sb = new StringBuilder(256);
handle = GetForegroundWindow();
if (GetWindowText(handle, sb, sb.Capacity) > 0)
{
label1.Text = "視窗標題:" + sb.ToString();
}
}
}
}
2017年12月19日 星期二
訂閱:
張貼留言 (Atom)
WPF聊天室应用(ASP.NET Core SignalR)
WPF聊天室应用(ASP.NET Core SignalR) https://www.bilibili.com/video/BV1Q741187Si?p=2 https://www.bilibili.com/video/BV1UV411e75T?from=search&...
-
介面,依賴反轉,單元測試 https://www.youtube.com/watch?v=GpYieGx4y6M 介面隔離,反射,特性,依賴注入 https://www.youtube.com/watch?v=3bZ4rNS_o10
-
https://mgleon08.github.io/blog/2018/07/16/jwt/ https://medium.com/%E9%BA%A5%E5%85%8B%E7%9A%84%E5%8D%8A%E8%B7%AF%E5%87%BA%E5%AE%B6%E7%AD%86%...
-
https://dotblogs.com.tw/v6610688/2015/02/19/iis_office_access_word_excel_com_interop_api_configuration https://dotblogs.com.tw/gelis/archi...
沒有留言:
張貼留言