Microsoft MVP성태의 닷넷 이야기
Vista : 34. IE 재시작 방법 [링크 복사], [링크+제목 복사],
조회: 9801
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 


Vista Compatibility Team Blog
- Internet Explorer caches settings
; http://blogs.msdn.com/vistacompatteam/archive/2007/02/07/internet-explorer-caches-settings.aspx

방금 전의 토픽에서 "RestartManager"를 언급해 드렸는데요.
바로 이 예제에서 언급된 것입니다.

IE 의 경우, 일부 설정 사항들을 캐쉬해놓고 있는데, 만약 그런 값들을 변경시켰다면 IE를 재시작해야만 반영이 된다고 합니다. 그럴 때 쓸 수 있는 방법으로 "RestartManager"를 제시하고 있습니다. 관련 코드까지 실어두어서 ^^ 도움이 되겠습니다.

아래는 똑같이 복사해 온 코드입니다.


DWORD dwVal = ERROR_SUCCESS; 
DWORD dwSessionHandle = (DWORD)-1; 
WCHAR wszSessionKey[CCH_RM_SESSION_KEY+1]; 
UINT nProcInfo = 100; 
UINT nProcInfoNeeded; 
DWORD lpdwRebootReason = 0; 
 
    //for demo purposes, hardcoded paths are used. 
DWORD nFiles = 2; 
LPWSTR rgsFiles[] = { L"c:\\program files\\internet explorer\\iexplore.exe", L"c:\\program files\\internet explorer\\ieuser.exe" }; 
 
RM_PROCESS_INFO *rgProcs = new RM_PROCESS_INFO[nProcInfo]; 
if (NULL == rgProcs) 
{ 
dwVal = ERROR_NOT_ENOUGH_MEMORY; 
goto RM_END; 
} 
 
// Starting Session 
dwVal = RmStartSession(&dwSessionHandle, 0, wszSessionKey); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
// Register items 
dwVal = RmRegisterResources(dwSessionHandle, nFiles, (LPCWSTR*) rgsFiles, 0, NULL, 0, NULL); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
// Getting affected apps 
dwVal = RmGetList(dwSessionHandle, &nProcInfoNeeded, &nProcInfo, rgProcs, &lpdwRebootReason); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
// Apply filter to shutdown iexplore processes only 
dwVal = RmAddFilter(dwSessionHandle, (LPCWSTR) rgsFiles[1], NULL, NULL, RmNoShutdown); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
// Shutdown iexplore processes 
dwVal = RmShutdown(dwSessionHandle, 0, NULL); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
// Remove previous filter & apply filter to shutdown ieuser only 
dwVal = RmRemoveFilter(dwSessionHandle, (LPCWSTR) rgsFiles[1], NULL, NULL); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
dwVal = RmAddFilter(dwSessionHandle, (LPCWSTR) rgsFiles[0], NULL, NULL, RmNoShutdown); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
// Shutdown ieuser process 
dwVal = RmShutdown(dwSessionHandle, 0, NULL); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
// Remove filter applied to ieuser process 
dwVal = RmRemoveFilter(dwSessionHandle, (LPCWSTR) rgsFiles[0], NULL, NULL); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
// Apply filter to restart ieuser process only 
dwVal = RmAddFilter(dwSessionHandle, (LPCWSTR) rgsFiles[0], NULL, NULL, RmNoRestart); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
// Restart ieuser 
dwVal = RmRestart(dwSessionHandle, NULL, NULL); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
// Remove previous filter & add filter to restart iexplore only 
dwVal = RmRemoveFilter(dwSessionHandle, (LPCWSTR) rgsFiles[0], NULL, NULL); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
dwVal = RmAddFilter(dwSessionHandle, (LPCWSTR) rgsFiles[1], NULL, NULL, RmNoRestart); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
// Restart iexplore 
dwVal = RmRestart(dwSessionHandle, NULL, NULL); 
if (ERROR_SUCCESS != dwVal) 
goto RM_END; 
 
RM_END: 
 
if (NULL != rgProcs) 
delete [] rgProcs; 
 
// Clean up session 
if (-1 != dwSessionHandle) 
RmEndSession(dwSessionHandle); 
 
return dwVal;



[이 토픽에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 2/8/2007]


비밀번호

댓글 작성자
 




... [16]  17  18  19  20  21  22  23  24  25  26  27  28  29  30  ...
NoWriterDateCnt.TitleFile(s)
800정성태7/10/200712157.NET 3.5 : 27. IQueryable 구현 방법 [3]
799정성태7/6/200710254VS.NET IDE : 36. MSBee 를 이용한 .NET 1.1 용 프로젝트 빌드
798정성태7/4/200710968VS.NET IDE : 35. 업데이트 - Publish Website hotfix for VS 2005 SP1
797정성태7/3/200711150Debug : 21. Image File Execution Options 키 동작 방식 [1]
796정성태7/3/200712616.NET 3.5 : 26. WCF - WebServiceHost
795정성태6/29/200713154Windows Update "사용 약관 읽기" 화면 잘림 현상
794정성태6/29/200711945Visual C++ : 11. Orcas - 마샬링 라이브러리
793정성태6/28/200711930TFS : 109. Daily Build파일 다운로드1
792정성태6/28/200711388개발 환경 구성: 104. Internet Explorer - Local Intranet 판단 옵션
791정성태6/25/200711725TFS : 108. Orcas - Continuous Integration 지원 [1]
790정성태6/24/200711823개발 환경 구성: 103. Internet Explorer 와 관련된 각종 개발 도구들
789정성태6/23/200712333Vista : 47. 비스타에서만 사용가능한 Managed 기능들 (2)
788정성태6/21/200712432개발 환경 구성: 102. Windows환경에서의 OpenSSL설치파일 다운로드1
787정성태6/21/200712127개발 환경 구성: 101. HttpSimulator
786정성태6/21/200712115TFS : 107. Team Build 와 다중 프로젝트 빌드 설정
785정성태6/19/200712995Vista : 46. 탐색기에서의 네트워크 파일 복사가 느린 문제를 해결하는 방법
784정성태6/19/200712085Windows 2008 : 3. 주요 변화 10가지
783정성태6/18/200713425SDK : 10. IERefreshElevationPolicy Win32 API
782정성태6/17/200711746.NET : 60. 프로젝트에서 참조한 Unmanaged DLL 을 GAC 에 배포하는 방법
781정성태6/16/200713380.NET 3.5 : 25. LINQ 와 동적 쿼리
780정성태6/16/200712477개발 환경 구성: 100. Windows 2008 - 터미널 서비스 Drain 모드
779정성태6/15/200712152SDK : 9. Windows SDK 구분하기
778정성태6/13/200712103Web : 1. Silverlight - Programming HTML with C#
777정성태6/13/200711609TFS : 106. Microsoft eScrum Version 1.0
776정성태6/13/200711881.NET 3.0 : 21. WPF 실습 - Outlook 2007 스타일의 응용 프로그램 개발
775정성태6/11/200712003TFS : 105. Visual Studio Team Foundation Server ? Project Server 2007 Connector
... [16]  17  18  19  20  21  22  23  24  25  26  27  28  29  30  ...