|
RegisterHotKey()란 API도 있군요. ^_^;;
CTRL-C와 CTRL-V를 처리하도록 하였으니 활용하시기 바랍니다.
행복하세요.
#include <vcl.h>
#pragma hdrstop
#include "tRegistryHotKey.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
const int DEF_CTRL_C = 0x1234;
const int DEF_CTRL_V = 0x1235;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
Application->OnMessage = OnAppMessage;
// CTRL-C가 눌리면 Handle Window(아래의 경우엔 현재 Form)에게 WM_HOTKEY가
// 발생하도록 합니다.
// 사용자는 메시지중 wParam이 DEF_CTRL_C인지 검사하여 처리해 주면 OK!
// 세번째 인수는 MOD_ALT, MOD_CONTROL, MOD_SHIFT 등의 조합이 올 수 있습니다.
::RegisterHotKey( Handle, DEF_CTRL_C, MOD_CONTROL, 'C' ); // Ctrl-C
::RegisterHotKey( Handle, DEF_CTRL_V, MOD_CONTROL, 'V' ); // Ctrl-V
}
//---------------------------------------------------------------------------
__fastcall TForm1::~TForm1( void )
{
// 사용이 끝나면 당근 해제....
UnregisterHotKey( Handle, DEF_CTRL_C );
UnregisterHotKey( Handle, DEF_CTRL_V );
}
//---------------------------------------------------------------------------
void __fastcall TForm1::OnAppMessage( tagMSG &msg, bool &bHandled )
{
if( msg.message == WM_HOTKEY ) { // 사용자 정의 핫키 처리부
switch( msg.wParam ) {
case DEF_CTRL_C :
bHandled = true;
ShowMessage( "CTRL-C" );
break;
case DEF_CTRL_V :
bHandled = true;
ShowMessage( "CTRL-V" );
break;
}
}
}
------------------------------
초보프머..궁금해T.T 님이 쓰신 글 :
: 전혀 감이 안잡히네여..
: 등록을 하면 이벤트 처리는 어디다가 하는지..등등
:
|