[한글 ActiveX C#] HwpCtrl 보안승인모듈 > C#

본문 바로가기

C#

[C#] [한글 ActiveX C#] HwpCtrl 보안승인모듈

회원사진
하나를하더라도최선을
2019-08-03 00:02 4,676 0

본문



한글 ActiveX 컨트롤을 사용하여 문서를 열 때 "접근을 허용하시겠습니까?" 라는 내용의 대화상자를 볼수 있다. 물론 이는 보안상 중요하나, 매 사용시 불편한 점이 많다.

이를 해결하는 방법으로 한글과 컴퓨터 홈페이지에 해결 방법들이 제시되어 있지만 C++, VB, HTML 로만 안내가 되어 있어서 따로 글을 남겨본다.

위의 링크로 가서 DLL을 다운로드 받는다.
해당 프로젝트의 bin\debug 폴더에 복사한다.(DLL의 이름은 바꿔줘도 상관 없다.)

샘플코드

const string HNCRoot = @"HKEY_Current_User\Software\HNC\HwpCtrl\Modules";
axHwpCtrl1.Clear();
string myProjectPath= Path.GetFullPath(".\\");
if (Microsoft.Win32.Registry.GetValue(HNCRoot, "FilePathCheckerModuleExample", "Not Exist").Equals("Not Exist"))
{
Microsoft.Win32.Registry.SetValue(HNCRoot, "FilePathCheckerModuleExample", projectPath + "FilePathCheckerModuleExample.dll");
}
axHwpCtrl1.RegisterModule("FilePathCheckDLL", "FilePathCheckerModuleExample");


string filePath = "파일명.hwp";
axHwpCtrl1.Open(filePath);


댓글목록0

등록된 댓글이 없습니다.
게시판 전체검색