Microsoft MVP성태의 닷넷 이야기
Vista : 34. IE 재시작 방법 [링크 복사], [링크+제목 복사],
조회: 12734
글쓴 사람
정성태 (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)
269정성태5/4/200613035Visual Studio 2005 Team System Level 200 Course Material
268정성태5/4/200613427Microsoft Component Installer Software Development Kit for Windows (x86) Version 2.0
267정성태5/4/200613464101 Code Samples for Visual Basic 2005
266정성태5/3/200615493Consolas Font Pack for Microsoft Visual Studio 2006 [2]
264정성태5/1/200614951Team System for C++ Developers
262정성태5/1/200625091Registry 등록 없이 COM 개체 사용 [1]파일 다운로드2
261정성태4/30/2006147254GB 메모리 인식 [2]
259정성태4/30/200613409Building ASP.NET 2.0 Web Sites Using Web Standards
260정성태4/30/200612805    답변글 XHTML Validator Modulle
258정성태4/29/200613337WebServiceStudio 2.0
263정성태5/1/200612799    답변글 Calling an Arbitrary Web Service
257정성태4/29/200612746TypeForwardedToAttribute
256정성태4/29/200612953Windows API - Using Condition Variables
252정성태4/26/200612798한글 관련 메세지 정리파일 다운로드1
251정성태4/26/200613457IIS 7.0 에서 소개되는 새로운 기능들 [1]
250정성태4/25/200613996툴 소개: VisualNDepend
249정성태4/25/200619983Integrating a debugger into Reflector
265정성태5/1/200614302    답변글 Deblector: First Version
285정성태5/15/200612305    답변글 New Deblector version ( an Add-In to debug with reflector )
248정성태4/21/200612586VS.NET 2005 Add-In : CSS Properties Window
247정성태4/21/200612421VS.NET 2005 Add-In : Spell Checker for HTML and ASP.NET pages
244정성태4/19/200612323SQL Server 2005 Service Pack 1
241정성태4/19/200611846VSTS Annotations for C++: Beyond Just Documenting Method Behavior [1]파일 다운로드1
240정성태4/18/200612493Accessing System Power and Network Status Using SENS
253정성태4/29/200612700    답변글 [HowToUse]: Accessing System Power and Network Status Using SENS
239정성태4/18/200612290Display a Web Page in a Plain C Win32 Application
... 31  32  33  34  35  36  [37]  38  39  40  41  42  43  44  45  ...