안녕하십니까!
델파이 초보입니다. 초등학교 교사인데요. 학교에서 사용할 간단한 프로그램을 짜고 있는데 Hwpctrl을 델파이7에서 임포트시켜 사용하려는데 문제가 있어 문의드립니다.
일단 아래와 같이 서브클래싱하였습니다. 이것도 제가 한 것이 아니고 다른 분의 소스입니다.
procedure TForm1.FormCreate(Sender: TObject);
begin
HNCWndProc := HwpCtrl1.WindowProc; // 원래의 WindProc 저장
HwpCtrl1.WindowProc := NewHNCWndProc; // 새로운 WndProc로 대치
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
HwpCtrl1.WindowProc := HNCWndProc; // 원래대로 복구
end;
procedure TForm1.NewHNCWndProc(var message : TMessage);
var
Action, Param : Variant;
begin
Action := HWPCtrl1.CreateAction('InsertText'); // 액션 생성
Param := Action.CreateSet; // 파라메터 생성
HNCWndProc(message); // 원래의 WndProc 실행
Case message.Msg of
WM_CHAR : begin
Param.SetItem('Text', Char(message.WParam)); // 영문찍기
Action.Execute(Param);
end;
WM_IME_COMPOSITION : // 한글일때
begin
if message.LParam <> 2048 then begin // 한글이 완성되었을 때의 처리
; // 여기서 완성된 글자 처리
end
else begin // 입력중인 미완성 한글찍기
Param.SetItem('Text', Char(Hi(message.WParam)) + Char(Lo(message.WParam)));
Action.Execute(Param);
end;
end;
end; // case
end;
문제는 한글변환키를 눌러도 작동하지 않는다는 것입니다. 도움 부탁드립니다.
|