2011/04/22

一年半了

我真的不適合用這種東西...
實在沒有記東西的習慣
網路讓我覺得很不安全...所以也沒啥秘密好寫的XD

2009/10/14

PS3 Card 哼哼

farlandx

終於在上星期五(2009/10/09)三機制霸了! 真開心~
這是我的玩家卡XD

2009/09/15

抓yam天空部落mp3的方法

將原網址 http://mymedia.yam.com/m/#####
改為 http://mymedia.yam.com/api/m/?pID=##### 就能看到mp3路徑了

2009/08/03

XP舊注音輸入法

載點

果然還是舊的輸入法好用,Windows 7和VISTA的注音10.0實在很難用

2009/08/02

生平第一台NB - SONY VAIO SR46TD/B入手


嗯...又敗家了XD
不過這台用起來還滿順手的,巧克力按鍵好棒喔!!

2009/07/24

MessageBoxTimeout

using System.Runtime.InteropServices;
using System.Threading;

class MessageBoxTimeout
{
[DllImport("kernel32.dll")]
private static extern uint GetCurrentThreadId();
private delegate int EnumWindowsProc(IntPtr hWnd, IntPtr lParam);

[DllImport("user32.dll")]
private static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam);

[DllImport("user32.dll", SetLastError = true)]
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);

[DllImport("user32.dll")]
private static extern int GetClassName(IntPtr hWnd, [Out] StringBuilder lpClassName, int nMaxCount);

[DllImport("user32.dll")]
private static extern bool IsWindowEnabled(IntPtr hWnd);

[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]

private static extern bool PostMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);

private class TimerThread
{
private readonly DateTime timeoutTime;
private readonly uint currentThreadId;
private bool terminateFlag;
private readonly Thread thread;

public TimerThread(int timeoutMillisec)
{
timeoutTime = DateTime.Now.AddMilliseconds(timeoutMillisec);
currentThreadId = GetCurrentThreadId();
terminateFlag = false;
thread = new Thread(ThreadProc);
thread.Start();
}

private void ThreadProc()
{
while (!terminateFlag)
{
Thread.Sleep(100);
if (DateTime.Now > timeoutTime)
{
EnumWindows(EnumWindowsProc, new IntPtr(0));
return;
}
}
}

private int EnumWindowsProc(IntPtr hWnd, IntPtr lParam)
{
uint processId;
uint threadId;
threadId = GetWindowThreadProcessId(hWnd, out processId);
if (threadId == currentThreadId)
{
StringBuilder className = new StringBuilder("", 256);
GetClassName(hWnd, className, 256);
if (className.ToString() == "#32770" && IsWindowEnabled(hWnd))
{
const int WM_COMMAND = 0x111;
PostMessage(hWnd, WM_COMMAND, new IntPtr(2), new IntPtr(0));
return 0;
}
}
return 1;
}

public void Terminate()
{
terminateFlag = true;
thread.Join();
}
}

public static DialogResult Show(string text, int timeoutMillsec)
{
TimerThread tt = new TimerThread(timeoutMillsec);
try
{
return MessageBox.Show(text);
}
finally
{
tt.Terminate();
}
}

public static DialogResult Show(string text, string caption, int timeoutMillsec)
{

TimerThread tt = new TimerThread(timeoutMillsec);
try
{
return MessageBox.Show(text, caption);
}
finally
{
tt.Terminate();
}
}

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, int timeoutMillsec)
{
TimerThread tt = new TimerThread(timeoutMillsec);
try
{
return MessageBox.Show(text, caption, buttons);
}
finally
{
tt.Terminate();
}
}

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, int timeoutMillsec)
{
TimerThread tt = new TimerThread(timeoutMillsec);
try
{
return MessageBox.Show(text, caption, buttons, icon);
}
finally
{
tt.Terminate();
}
}

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, int timeoutMillsec)
{
TimerThread tt = new TimerThread(timeoutMillsec);
try
{
return MessageBox.Show(text, caption, buttons, icon, defaultButton);
}
finally
{
tt.Terminate();
}
}

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, int timeoutMillsec)
{
TimerThread tt = new TimerThread(timeoutMillsec);
try
{
return MessageBox.Show(text, caption, buttons, icon, defaultButton, options);
}
finally
{
tt.Terminate();
}
}
}

2009/07/05

今天終於實現我小小的夢想了

Photobucket
這顆樹上爬滿了松鼠,雖然拍到的不多,但上面確實有將近10隻哦!!

小時候每週日老媽都會帶我跟我弟到台北靈糧堂做禮拜
討厭基督教的我,總是會在兒童主日學開始的時候逃出去亂逛
但那附近只有一個地方能讓我逛,就是大安森林公園

當時的大安森林公園才剛開始建設,很多樹都是剛移過去
所以整遍地看起來一點也沒有森林的感覺
從那時我就在心中默默許下一個願望「將來等這些樹長大我一定要來做森林浴」
之前想到這個願望的時候總是沒辦法過來

直到今天......終於實現我小小的夢想了!
果然樹都長高的樣子很棒,在雨後的樹林中漫步也很浪漫
且身旁有一個很重要的人陪著,讓我洗了一個很棒的森林浴:D