Microsoft MVP성태의 닷넷 이야기
Vista : 34. IE 재시작 방법 [링크 복사], [링크+제목 복사],
조회: 12276
글쓴 사람
정성태 (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]


비밀번호

댓글 작성자
 




... [46]  47 
NoWriterDateCnt.TitleFile(s)
43정성태12/28/200412024VSMT 소개: Physical Server to Virtual Server
68정성태3/2/200511872    답변글 [추가]: VSMT 소개: ADS 1.0
42정성태12/27/200411260VS.NET 2005 : What should I do if I get a message that says, "Team system server is not available; please contact your system administrator."?
41정성태12/25/200411675Ten things to know before starting VSTS Foundation Server Installation
40정성태12/25/200411599SQL Server 2005 에서 반가운 기능 : 재귀 SELECT 와 ROW_NUMBER
39정성태12/24/200410722VS.NET 2005 : Navigate the .NET Framework and Your Projects with "My"파일 다운로드1
38정성태12/24/200410828Smart Client Architecture and Design Guide
37정성태12/24/200411484Translation Guide: Moving Your Programs from Managed Extensions for C++ to C++/CLI
36정성태12/23/20041115713가지 주의 사항: Visual C++ .NET 프로그램을 Visual Studio 2005로 이식하기 전에 알아야 할 13가지 내용
35정성태12/26/200411609Windows Sharepoint Services 를 설치한 이후 ASP.NET 오류 문제파일 다운로드1
34정성태12/9/200411759SQL Server 구성이 실패파일 다운로드1
33정성태12/7/200411710RSS 에 대한 자세한 설명
32정성태12/5/200411449How To Troubleshoot MS DTC Firewall Issues
31정성태12/5/200411105HOWTO: Enable DTC Between Web Servers and SQL Servers Running Windows Server 2003
29정성태12/4/200410936IP 변경하는 NETSH 명령
28정성태11/20/200411294혼합 DLL 로드 문제
27정성태11/20/200411079Web Services Enhancements 2.0을 사용한 프로그래밍
26정성태11/20/200411518SQL 주입 공격을 사전에 차단하는 방법
25정성태10/20/200411137Invoking .NET Events from Native C++
24정성태10/16/200410535Windows Rights Management 서비스(RMS) 1.0
23정성태10/16/200411257[ASP.NET] Working with Client-Side Script
21정성태10/3/200411290HOWTO: ASP.NET 유틸리티를 사용하여 자격 증명 및 세션 상태 연결 문자열 암호화
20정성태10/3/200411313IE 에서 XML 파일을 보는 경우, XMLDocument 를 얻어내는 방법.
22정성태10/3/200412035    답변글 [내용 보강] .NET 언어에서 IE에 보여진 XMLDocument 개체 접근하기
19정성태10/3/200411082.NET 리모팅에서 MBR 개체를 전송하는 경우의 xxx.exe.config 파일 설정방법
18정성태9/19/200411814HTML SELECT 요소에 OPTION 요소를 채우는 C/C++ 예제파일 다운로드1
... [46]  47