星期五, 11月 05, 2010

利用 vb.net 偵測全域的滑鼠及鍵盤動作

使用windowshooklib

http://www.vbforums.com/showthread.php?t=436321


http://www.code2point.com/Project.aspx?proj=4

使用方法就是下載其 WindowsHookLib.dll , 在 .net 專案中加入此參考,





Imports WindowsHook

Public Class Form1
Dim WithEvents mHook As New MouseHook

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
'Install the mouse hook
mHook.InstallHook()
Catch ex As Exception
MessageBox.Show("Failed to install the mouse hook!." _
& Environment.NewLine & ex.Message, "Hook Error!", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
'Remove the mouse hook
mHook.RemoveHook()
Catch ex As Exception
MessageBox.Show("Error removing the mouse hook!." _
& Environment.NewLine & ex.Message, "Hook Error!", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

End Sub

Private Sub mHook_MouseDown(ByVal sender As Object, ByVal e As WindowsHook.MouseEventArgs) Handles mHook.MouseDown
'Set the Handled property for the mouse down event
'to block the mouse down message for the
'controls that are not in the alowedList.
'e.Handled = Not Me.alowedList.Contains(CType(sender, IntPtr))
'Do some other things here
'...
'Me.TextBox1.Text = "mouse down"
Me.TextBox1.Text = e.Button.ToString
'...
End Sub
End Class


星期三, 7月 14, 2010

半形轉全形 (php)




function n_to_w($strs, $types = '0'){ // narrow to wide , or wide to narrow
$nt = array(
"(", ")", "[", "]", "{", "}", ".", ",", ";", ":",
"-", "?", "!", "@", "#", "$", "%", "&", "|", "\\",
"/", "+", "=", "*", "~", "`", "'", "\"", "<", ">",
"^", "_",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
"k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
"u", "v", "w", "x", "y", "z",
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
"U", "V", "W", "X", "Y", "Z",
" "
);
$wt = array(
"(", ")", "〔", "〕", "{", "}", "﹒", ",", ";", ":",
"-", "?", "!", "@", "#", "$", "%", "&", "|", "\",
"/", "+", "=", "*", "~", "、", "、", """, "<", ">",
"︿", "_",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
"k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
"u", "v", "w", "x", "y", "z",
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
"U", "V", "W", "X", "Y", "Z",
" "
);

if ($types == '0'){
// narrow to wide
$strtmp = str_replace($nt, $wt, $strs);
}else{
// wide to narrow
$strtmp = str_replace($wt, $nt, $strs);
}
return $strtmp;
}

台北城中扶輪社網址

台北城中扶輪社
Rotary Club of Taipei Castle
www.taipei-castle.org.tw

星期二, 6月 22, 2010

超肥的Microsoft Office 輸入法 2010

真是厲害, 輸入法竟然能搞到 131.2 MB