Microsoft MVP성태의 닷넷 이야기
Vista : 34. IE 재시작 방법 [링크 복사], [링크+제목 복사],
조회: 9821
글쓴 사람
정성태 (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)
750정성태5/18/200711170IIS : 15. WCAT 6.3
749정성태5/17/200710862TFS : 99. MSF Process Template for CMMI Process Improvement - v4.1 [1]
748정성태5/15/20079589VS.NET IDE : 32. Add-in : Paste XML as serializable type
747정성태5/15/200710151.NET 3.5 : 16. ADO.NET Orcas Sample Provider - Beta1
746정성태5/15/20079719VS.NET IDE : 31. Orcas - PowerTools for Team Architect
745정성태5/12/20079667VS.NET IDE : 30. Orcas - TDD 를 위한 기능 강화
744정성태5/10/20079511.NET 3.5 : 15. Orcas - ADO.NET vNext 맛보기
743정성태5/10/20079914TFS : 98. VSTT 의 수동 테스트를 위한 엑셀 파일 등록 방법
742정성태5/9/20079763기타 : 2. Javascript 의 객체지향 구현.
741정성태5/9/200710171VS.NET IDE : 29. Orcas - 보다 더 엄격한 네이밍/디자인 규칙 적용
740정성태5/9/200710013개발 환경 구성: 98. USB 하드 드라이브를 XP 부팅 가능하게 만드는 방법
739정성태5/4/200710247.NET 3.0 : 20. CardSpace를 웹 사이트에 적용하는 방법
738정성태5/4/200710838개발 환경 구성: 97. WIX 사례 - 제어판에 응용 프로그램 등록
737정성태5/1/20079470개발 환경 구성: 96. VPC 에 BitLocker 구성
736정성태4/28/20079587Debug : 17. WinDBG 에서의 함수 호출
735정성태4/26/20079998IIS : 14. IIS 7의 새로운 기능들 [1]
734정성태4/26/200710361IIS : 13. HTTP 연결 프로세스 == SYSTEM ?
732정성태4/26/200710024Debug : 16. 해제된 DLL 로 인한 문제가 발생했을 때의 원인 추적.파일 다운로드1
731정성태4/26/200710116.NET 3.0 : 19. WCF 서비스 호스트의 using 처리에 대해.
730정성태4/25/20079858TFS : 97. 프로그래밍을 통한 팀 빌드 실행 [1]
733정성태4/26/20079711    답변글 TFS : 97.1 프로그래밍을 통한 팀 빌드 실행 - PowerShell 버전
729정성태4/24/200711167.NET : 57. "Index was outside the bounds of the array" 공개 패치
728정성태4/23/20079909.NET 3.5 : 14. Orcas 에 소개되는 새로운 기능 - Query Syntax
727정성태4/23/20079525개발 환경 구성: 95. NetPing 유틸리티 소개
726정성태4/23/20079986TFS : 96. TFS Migration and Synchronization Toolkit
725정성태4/22/200711486개발 환경 구성: 94. App.config 의 설정 분리 방법
... 16  17  [18]  19  20  21  22  23  24  25  26  27  28  29  30  ...