Re: Closing Running Programs (final)
- From: TJ <someone@xxxxxxxxxxxxx>
- Date: Fri, 03 Feb 2006 23:26:02 -0600
What I would do is create a log file and open it, write the window text, close it before each time you kill a window. Then analyze the log when it crashes your device and the last one on the log should be the culprit.
blue wrote:
I've read all usenet posts, forum threads and all other resources I could find till this time and none of them demistified how the user can close all running programs (just like in Start->Settings->Memory->Stop Running Programs). Here's my solution based on all those resources and *still* sometimes my device crash (it happens periodically, in no specific situations - which makes this problem even worse to clarify). Here's the code snippet and *every* help is most appreciated (specially the one concerning my conditions - I think I've included them all?):.
BOOL CALLBACK EnumAndKill(HWND hWnd, LPARAM lParam){
TCHAR szText[MAX_PATH+1];
CString text;
ZeroMemory(szText, sizeof(TCHAR)*(MAX_PATH+1));
if(((GetWindowLong(hWnd,GWL_EXSTYLE) & WS_EX_TOOLWINDOW)!=WS_EX_TOOLWINDOW)
&& ((GetWindowLong(hWnd, GWL_STYLE) & WS_VISIBLE) == WS_VISIBLE)
&& ((GetWindowLong(hWnd, GWL_STYLE) & WS_POPUP) != WS_POPUP)
&& (GetWindowTextLength(hWnd)>0) && (hWnd != GetDesktopWindow()
&& (IsWindowEnabled(hWnd) == TRUE) && (GetParent(hWnd) == NULL))){
GetWindowText(hWnd, szText, MAX_PATH);
text.Format(_T("%s"), szText);
if(text!="My Program"){
PostMessage(hWnd,WM_CLOSE,0,0);
return TRUE;
}
- References:
- Closing Running Programs (final)
- From: blue
- Closing Running Programs (final)
- Prev by Date: WM5.0 / Icon Button question
- Next by Date: Cant find system.IO
- Previous by thread: Closing Running Programs (final)
- Next by thread: Re: Closing Running Programs (final)
- Index(es):