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


비밀번호

댓글 작성자
 




... 31  32  33  34  35  36  37  38  39  40  41  42  43  [44]  45  ...
NoWriterDateCnt.TitleFile(s)
92정성태5/5/200511895XP SP2 방화벽에 대한 내용을 정라한 블로그 소개
91정성태5/5/200512460구글 맵 ( Microsoft MapPoint 수준 )
90정성태4/21/200512342Virtual Server 2005 SP1 beta
89정성태4/1/20051234864bit Windows 2003(x64) , 32bit Windows 2003 SP1 배포
88정성태3/31/200511720HTML to XHTML
87정성태3/31/200512710NewSID : Ghost / VPC 등으로 복제된 컴퓨터의 SID 를 변경
86정성태3/31/200512106Push and Run .NET Code on Remote Machine
84정성태3/25/200511236NET Framework v2 Beta 2 Obsolete APIs
83정성태3/25/200511757서버 운영체제 라이센싱 및 지원 비용 비교 보고서파일 다운로드1
80정성태3/22/200512938VS.NET 2005 가격정책
82정성태3/24/200512337    답변글 VS.NET 2005, SQL 2005 출시 연기
78정성태3/21/200513089ASP.NET
77정성태3/13/200512726Virtual Server : COM 개체로 다루기
75정성태3/9/200511879C# to Visual Basic.NET Translation Tool
79정성태3/22/200512381    답변글 PHP ompiler for .NET Framework
81정성태3/23/200511900    답변글 Microsoft Java Language Conversion Assistant 3.0 beta
85정성태3/27/200512387    답변글 Convert VBA Code to Visual Basic .NET When Migrating to Visual Studio 2005 Tools for Office
74정성태3/9/200511909Internet Explorer 7 곧 출시 예정
73정성태3/4/200512452Developing Solutions with Microsoft InfoPath - Companion Content
72정성태3/4/200512546레지스트리 Control Set 과 CurrentControlSet 의 의미.
71정성태3/4/200511355환경 변수를 등록 후에 시스템에 알리는 방법
70정성태3/4/200512729.NET Tools: Ten Must-Have Tools Every Developer Should Download Now [1]
69정성태3/3/200511399SQL Server 2005 - beta 3
67정성태4/1/200512915스마트 클라이언트 외부 자료 링크
66정성태2/19/200511579오라클 DB 를 Microsoft SQL Server 로 마이그레이션 하기파일 다운로드1
65정성태2/15/200512447Office 2003: XML Reference Schemas
... 31  32  33  34  35  36  37  38  39  40  41  42  43  [44]  45  ...