diff -uNr common.org/alarmstruct.c common/alarmstruct.c
--- common.org/alarmstruct.c	2004-03-06 21:33:00.000000000 +0900
+++ common/alarmstruct.c	2005-04-26 22:19:34.000000000 +0900
@@ -50,6 +50,9 @@
 		pAS[i].bBootExec = GetMyRegLong(subkey, "OnBoot", FALSE);
 		pAS[i].bInterval = GetMyRegLong(subkey, "Interval", FALSE);
 		pAS[i].nInterval = GetMyRegLong(subkey, "IntervalMinutes", 0);
+		pAS[i].bResumeExec = GetMyRegLong(subkey, "OnResume", FALSE);
+		pAS[i].nResumeDelay = GetMyRegLong(subkey, "ResumeDelay", 0);
+		pAS[i].bResumeTimer = FALSE;
 		
 		SetAlarmTime(pAS + i);
 	}
@@ -81,6 +84,8 @@
 		SetMyRegLong(subkey, "OnBoot", pAS[i].bBootExec);
 		SetMyRegLong(subkey, "Interval", pAS[i].bInterval);
 		SetMyRegLong(subkey, "IntervalMinutes", pAS[i].nInterval);
+		SetMyRegLong(subkey, "OnResume", pAS[i].bResumeExec);
+		SetMyRegLong(subkey, "ResumeDelay", pAS[i].nResumeDelay);
 	}
 }
 
diff -uNr common.org/common.h common/common.h
--- common.org/common.h	2004-09-07 16:46:26.000000000 +0900
+++ common/common.h	2005-04-26 21:11:10.000000000 +0900
@@ -117,6 +117,9 @@
 	BOOL bInterval;
 	int  nInterval;
 	DWORD tickLast;
+	BOOL bResumeExec;
+	int  nResumeDelay;
+	BOOL bResumeTimer;
 } ALARMSTRUCT;
 typedef ALARMSTRUCT* PALARMSTRUCT;
 
diff -uNr exe.org/alarm.c exe/alarm.c
--- exe.org/alarm.c	2004-05-10 23:32:00.000000000 +0900
+++ exe/alarm.c	2005-04-26 21:22:10.000000000 +0900
@@ -84,6 +84,8 @@
 						pAS->tickLast = GetTickCount();
 					m_bCheckEverySeconds = TRUE;
 				}
+				if(pAS->bResumeExec)
+					m_bCheckEverySeconds = TRUE;
 			}
 		}
 	}
@@ -105,6 +107,7 @@
 {
 	PALARMSTRUCT pAS;
 	static int hourLast = 0, minuteLast = 0;
+	static DWORD resumeTick = 0;
 	int i, hour, loops;
 	
 	if(!m_pAlarm) return;
@@ -117,6 +120,9 @@
 		hourLast = st->wHour;
 		minuteLast = st->wMinute;
 	}
+	// save resume time
+	if(reason == 2)
+		resumeTick = GetTickCount();
 	
 	for(i = 0; i < m_numAlarm; i++)
 	{
@@ -158,6 +164,29 @@
 			if(pAS->bBootExec) bexec = TRUE;
 		}
 		
+		// Execute on resume
+		if(reason == 2 && pAS->bResumeExec)
+		{
+			if(pAS->nResumeDelay == 0)
+			{
+				bexec = TRUE;
+				pAS->bResumeTimer = FALSE;
+			}
+			else
+			{
+				pAS->bResumeTimer = TRUE;
+				continue;
+			}
+		}
+		if(reason == 0 && pAS->bResumeTimer)
+		{
+			if(GetTickCount() - resumeTick > pAS->nResumeDelay * 1000)
+			{
+				bexec = TRUE;
+				pAS->bResumeTimer = FALSE;
+			}
+		}
+		
 		// At regular intervals
 		if(st && pAS->bInterval && pAS->nInterval > 0)
 		{
diff -uNr exe.org/main2.c exe/main2.c
--- exe.org/main2.c	2004-05-09 22:29:00.000000000 +0900
+++ exe/main2.c	2005-04-08 20:28:34.000000000 +0900
@@ -20,6 +20,9 @@
 
 /* Statics */
 
+typedef BOOL (WINAPI *pfnImmDisableIME)(DWORD);
+
+static void DisableIME(void);
 static void InitTClockMain(void);
 static BOOL CheckTCDLL(void);
 static void InitTextColor(void);
@@ -42,6 +45,8 @@
 		return 1;
 	}
 	
+	DisableIME();
+	
 	if(!CheckTCDLL()) { return 1; }
 	
 	if(FindWindow("ObjectBar Toolbar", NULL))
@@ -71,6 +76,8 @@
 		CLASS_TCLOCKMAIN, TITLE_TCLOCKMAIN, WS_OVERLAPPEDWINDOW,
 		CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
 		NULL, NULL, g_hInst, NULL);
+	ShowWindow(hwnd, SW_MINIMIZE);
+	ShowWindow(hwnd, SW_HIDE);
 	// ShowWindow(hwnd, SW_SHOW);
 	// UpdateWindow(hwnd);
 	
@@ -92,6 +99,27 @@
 }
 
 /*-------------------------------------------
+  disable IME
+---------------------------------------------*/
+void DisableIME(void)
+{
+	HMODULE hImm32;
+	pfnImmDisableIME pImmDisableIME;
+	
+	hImm32 = LoadLibrary("imm32.dll");
+	if (hImm32 == NULL)
+		return;
+	pImmDisableIME = (pfnImmDisableIME)
+			GetProcAddress(hImm32, "ImmDisableIME");
+	if (pImmDisableIME == NULL)
+		return;
+	
+	pImmDisableIME(0);
+	
+	FreeLibrary(hImm32);
+}
+
+/*-------------------------------------------
   initialize variables, format, etc.
 ---------------------------------------------*/
 void InitTClockMain(void)
diff -uNr exe.org/menu.c exe/menu.c
--- exe.org/menu.c	2004-09-07 17:15:48.000000000 +0900
+++ exe/menu.c	2005-04-08 22:54:22.000000000 +0900
@@ -116,6 +116,8 @@
 	// open popup menu
 	TrackPopupMenu(m_hMenu, TPM_LEFTALIGN|TPM_RIGHTBUTTON,
 		xPos, yPos, 0, hwnd, NULL);
+	
+	PostMessage(hwnd, WM_NULL, 0, 0);
 }
 
 /*------------------------------------------------
@@ -147,6 +149,7 @@
 	curthread = GetWindowThreadProcessId(GetForegroundWindow(), &pid);
 	mythread = GetCurrentThreadId();
 	AttachThreadInput(mythread, curthread, TRUE);
+	SetForegroundWindow(hwnd);
 	SetFocus(hwnd);
 	AttachThreadInput(mythread, curthread, FALSE);
 }
diff -uNr exe.org/mouse.c exe/mouse.c
--- exe.org/mouse.c	2004-09-07 17:16:32.000000000 +0900
+++ exe/mouse.c	2005-04-09 00:35:08.000000000 +0900
@@ -106,9 +106,11 @@
 	if(message == WM_RBUTTONDOWN &&
 		(!m_pMouseCommand || m_bRClickMenu))
 	{
+	/*
 		POINT pt;
 		GetCursorPos(&pt);
 		OnContextMenu(hwnd, NULL, pt.x, pt.y);
+	*/
 		return;
 	}
 	
@@ -172,6 +174,16 @@
 	if(m_bTimer) KillTimer(hwnd, IDTIMER_MOUSE);
 	m_bTimer = FALSE;
 	
+	if(message == WM_RBUTTONUP &&
+		(!m_pMouseCommand || m_bRClickMenu))
+	{
+		POINT pt = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
+		ClientToScreen(GetClockWindow(), &pt);
+		ScreenToClient(hwnd, &pt);
+		DefWindowProc(hwnd, message, wParam, MAKELPARAM(pt.x, pt.y));
+		return;
+	}
+	
 	if(!m_pMouseCommand) return;
 	
 	if(message == WM_LBUTTONUP && m_bStartMenuFromClock)
diff -uNr exe.org/tclock.h exe/tclock.h
--- exe.org/tclock.h	2004-09-07 17:14:52.000000000 +0900
+++ exe/tclock.h	2005-04-09 00:33:52.000000000 +0900
@@ -7,6 +7,7 @@
 #define WINVER       0x0400
 
 #include <windows.h>
+#include <windowsx.h>
 #include <mmsystem.h>
 #include <shlobj.h>
 #include "../common/common.h"
diff -uNr exe.org/wndproc.c exe/wndproc.c
--- exe.org/wndproc.c	2004-03-16 22:43:00.000000000 +0900
+++ exe/wndproc.c	2005-04-26 21:15:58.000000000 +0900
@@ -19,6 +19,7 @@
 static void OnCreate(HWND hwnd);
 static void OnDestroy(HWND hwnd);
 static void ClearTClockMain(HWND hwnd);
+static void OnPowerBroadcast(HWND hwnd, WPARAM wParam);
 static void OnTimerStart(HWND hwnd);
 static void OnTimerMain(HWND hwnd);
 static void OnTCMHwndClock(HWND hwnd, LPARAM lParam);
@@ -50,6 +51,10 @@
 			if(wParam) ClearTClockMain(hwnd);
 			break;
 		
+		case WM_POWERBROADCAST:
+			OnPowerBroadcast(hwnd, wParam);
+			return TRUE;
+		
 		case WM_TIMER:
 			switch (wParam)
 			{
@@ -75,7 +80,8 @@
 			return 0;
 		case WM_CONTEXTMENU:
 			// menu.c
-			OnContextMenu(hwnd, (HWND)wParam, LOWORD(lParam), HIWORD(lParam));
+			OnContextMenu(hwnd, (HWND)wParam,
+				GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
 			return 0;
 		case WM_EXITMENULOOP:
 			// menu.c
@@ -209,6 +215,21 @@
 }
 
 /*-------------------------------------------------------
+  WM_POWERBROADCAST message
+---------------------------------------------------------*/
+void OnPowerBroadcast(HWND hwnd, WPARAM wParam)
+{
+	switch (wParam) {
+		case PBT_APMRESUMESUSPEND:
+			OnTimerAlarm(hwnd, NULL, 2);
+			break;
+			
+		default:
+			break;
+	}
+}
+
+/*-------------------------------------------------------
   WM_TIMER message, wParam = IDTIMER_START
   start customizing the tray clock
 ---------------------------------------------------------*/
diff -uNr property.org/pagealarm.c property/pagealarm.c
--- property.org/pagealarm.c	2004-06-30 14:50:00.000000000 +0900
+++ property/pagealarm.c	2005-04-26 22:35:18.000000000 +0900
@@ -29,6 +29,7 @@
 static void OnFileChange(HWND hDlg);
 static void OnTest(HWND hDlg, WORD id);
 static void OnInterval(HWND hDlg);
+static void OnResumeExec(HWND hDlg);
 static void EnableAlarmPageItems(HWND hDlg);
 static void GetAlarmFromDlg(HWND hDlg, PALARMSTRUCT pAS);
 static void SetAlarmToDlg(HWND hDlg, PALARMSTRUCT pAS);
@@ -85,6 +86,7 @@
 				case IDC_SECONDALARM:
 				case IDC_WDAYALARM:
 				case IDC_ALARMINTERVALMIN:
+				case IDC_ALARMRESUMEDELAY:
 					if(code == EN_CHANGE)
 						SendPSChanged(hDlg);
 					break;
@@ -116,6 +118,10 @@
 					OnInterval(hDlg);
 					SendPSChanged(hDlg);
 					break;
+				case IDC_ALARMRESUMEEXEC:
+					OnResumeExec(hDlg);
+					SendPSChanged(hDlg);
+					break;
 			}
 			return TRUE;
 		}
@@ -480,6 +486,22 @@
 }
 
 /*------------------------------------------------
+  "Execute when resumed" checkbox
+--------------------------------------------------*/
+void OnResumeExec(HWND hDlg)
+{
+	HWND hwnd = GetDlgItem(hDlg, IDC_ALARMRESUMEEXEC);
+	BOOL b = IsDlgButtonChecked(hDlg, IDC_ALARMRESUMEEXEC);
+	
+	if(!IsDlgButtonChecked(hDlg, IDC_ENABLEALARM)) b = FALSE;
+	
+	hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
+	EnableWindow(hwnd, b);
+	hwnd = GetNextWindow(hwnd, GW_HWNDNEXT);
+	EnableWindow(hwnd, b);
+}
+
+/*------------------------------------------------
   enable/disable all dialog items
 --------------------------------------------------*/
 void EnableAlarmPageItems(HWND hDlg)
@@ -517,6 +539,8 @@
 	pAS->bBootExec = IsDlgButtonChecked(hDlg, IDC_ALARMBOOTEXEC);
 	pAS->bInterval = IsDlgButtonChecked(hDlg, IDC_ALARMINTERVAL);
 	pAS->nInterval = GetDlgItemInt(hDlg, IDC_ALARMINTERVALMIN, NULL, FALSE);
+	pAS->bResumeExec = IsDlgButtonChecked(hDlg, IDC_ALARMRESUMEEXEC);
+	pAS->nResumeDelay = GetDlgItemInt(hDlg, IDC_ALARMRESUMEDELAY, NULL, FALSE);
 }
 
 /*------------------------------------------------
@@ -540,7 +564,10 @@
 	CheckDlgButton(hDlg, IDC_ALARMBOOTEXEC, pAS ? pAS->bBootExec : FALSE);
 	CheckDlgButton(hDlg, IDC_ALARMINTERVAL, pAS ? pAS->bInterval : FALSE);
 	SetDlgItemInt(hDlg, IDC_ALARMINTERVALMIN, pAS ? pAS->nInterval : 0, FALSE);
+	CheckDlgButton(hDlg, IDC_ALARMRESUMEEXEC, pAS ? pAS->bResumeExec : FALSE);
+	SetDlgItemInt(hDlg, IDC_ALARMRESUMEDELAY, pAS ? pAS->nResumeDelay : 0, FALSE);
 	
 	OnEnableAlarm(hDlg);
 	OnInterval(hDlg);
+	OnResumeExec(hDlg);
 }
diff -uNr property.org/resource.h property/resource.h
--- property.org/resource.h	2004-04-24 17:03:00.000000000 +0900
+++ property/resource.h	2005-04-26 21:59:08.000000000 +0900
@@ -135,6 +135,8 @@
 #define IDC_ALARMBOOTEXEC               1316
 #define IDC_ALARMINTERVAL               1317
 #define IDC_ALARMINTERVALMIN            1318
+#define IDC_ALARMRESUMEEXEC             1319
+#define IDC_ALARMRESUMEDELAY            1320
 
 #define IDC_ALARMDAY0                   1350
 #define IDC_ALARMDAY1                   1351
Files property.org/tcprop.aps and property/tcprop.aps differ
diff -uNr property.org/tcprop.rc property/tcprop.rc
--- property.org/tcprop.rc	2004-04-24 17:03:00.000000000 +0900
+++ property/tcprop.rc	2005-04-26 22:58:22.000000000 +0900
@@ -151,7 +151,7 @@
     PUSHBUTTON      "Cancel",IDCANCEL,85,85,50,14
 END
 
-IDD_PAGEALARM DIALOG DISCARDABLE  0, 0, 210, 183
+IDD_PAGEALARM DIALOG DISCARDABLE  0, 0, 210, 186
 STYLE DS_CONTROL | WS_CHILD
 FONT 9, "MS Sans Serif"
 BEGIN
@@ -161,33 +161,37 @@
     PUSHBUTTON      "Add",IDC_ADDALARM,136,5,33,14
     PUSHBUTTON      "Delete",IDC_DELALARM,175,5,33,14
     CONTROL         "Enable",IDC_ENABLEALARM,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,49,24,42,11
-    RTEXT           "Hour",IDC_STATIC,0,43,43,12
-    EDITTEXT        IDC_HOURALARM,49,40,80,13,ES_AUTOHSCROLL
+                    WS_TABSTOP,49,23,42,11
+    RTEXT           "Hour",IDC_STATIC,0,42,43,12
+    EDITTEXT        IDC_HOURALARM,49,39,80,13,ES_AUTOHSCROLL
     CONTROL         "12H",IDC_12HOURALARM,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,135,42,42,11
-    RTEXT           "Minute",IDC_STATIC,0,62,43,12
-    EDITTEXT        IDC_MINUTEALARM,49,59,80,13,ES_AUTOHSCROLL
-    RTEXT           "Second",IDC_STATIC,132,62,31,12
-    EDITTEXT        IDC_SECONDALARM,169,59,22,13,ES_AUTOHSCROLL
-    RTEXT           "Day of Week",IDC_STATIC,0,82,43,12
-    EDITTEXT        IDC_WDAYALARM,49,79,80,13,ES_AUTOHSCROLL
-    PUSHBUTTON      "...",IDC_SANSHOWDAY,134,79,15,14
-    RTEXT           "File",IDC_STATIC,0,106,43,11
-    EDITTEXT        IDC_FILEALARM,49,104,140,13,ES_AUTOHSCROLL
-    PUSHBUTTON      "...",IDC_SANSHOALARM,194,104,15,14
-    RTEXT           "Test",IDC_STATIC,0,126,43,11
-    PUSHBUTTON      "",IDC_TESTALARM,49,123,15,14,BS_ICON
+                    WS_TABSTOP,135,41,42,11
+    RTEXT           "Minute",IDC_STATIC,0,60,43,12
+    EDITTEXT        IDC_MINUTEALARM,49,57,80,13,ES_AUTOHSCROLL
+    RTEXT           "Second",IDC_STATIC,132,60,31,12
+    EDITTEXT        IDC_SECONDALARM,169,57,22,13,ES_AUTOHSCROLL
+    RTEXT           "Day of Week",IDC_STATIC,0,79,43,12
+    EDITTEXT        IDC_WDAYALARM,49,76,80,13,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_SANSHOWDAY,134,76,15,14
+    RTEXT           "File",IDC_STATIC,0,100,43,11
+    EDITTEXT        IDC_FILEALARM,49,98,140,13,ES_AUTOHSCROLL
+    PUSHBUTTON      "...",IDC_SANSHOALARM,194,98,15,14
+    RTEXT           "Test",IDC_STATIC,0,120,43,11
+    PUSHBUTTON      "",IDC_TESTALARM,49,117,15,14,BS_ICON
     CONTROL         "Repeat",IDC_REPEATALARM,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,95,125,45,11
+                    WS_TABSTOP,95,119,45,11
     CONTROL         "Blink",IDC_BLINKALARM,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,147,125,43,11
+                    WS_TABSTOP,147,119,43,11
     CONTROL         "Execute when TClock is started",IDC_ALARMBOOTEXEC,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,49,145,125,12
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,49,139,125,12
+    CONTROL         "Execute when resumed",IDC_ALARMRESUMEEXEC,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,49,155,87,10
+    EDITTEXT        IDC_ALARMRESUMEDELAY,153,152,27,13,ES_AUTOHSCROLL
+    LTEXT           "sec",IDC_STATIC,184,155,11,8
     CONTROL         "At regular intervals:",IDC_ALARMINTERVAL,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,49,163,76,12
-    EDITTEXT        IDC_ALARMINTERVALMIN,128,162,27,13,ES_AUTOHSCROLL
-    LTEXT           "minutes",IDC_STATIC,159,164,31,11
+                    BS_AUTOCHECKBOX | WS_TABSTOP,49,170,76,12
+    EDITTEXT        IDC_ALARMINTERVALMIN,128,169,27,13,ES_AUTOHSCROLL
+    LTEXT           "minutes",IDC_STATIC,159,171,31,11
 END
 
 IDD_ALARMDAY DIALOG DISCARDABLE  0, 0, 198, 115
