|
단축키를 등록했는데 폼이 Active상태가 아닌데도 단축키가 먹네요.
현재 아래와 같이 소스 구성했구요.
void __fastcall TFrmMain::OnAppMessage( tagMSG &msg, bool &bHandled )
요 함수에서 뭔가를 해야 할것 같은데 잘 모르겠어요.
bHandled를 false로 해도 안되네요..
어떻게 해야 할까요?
const int DEF_VK_LEFT = 0x1235;
const int DEF_VK_RIGHT = 0x1236;
const int DEF_VK_UP = 0x1237;
const int DEF_VK_DOWN = 0x1238;
bool IsActive ;
//---------------------------------------------------------------------------
void __fastcall TFrmMain::TFrmMain(void)
{
IsActive = true ;
Application->OnMessage = OnAppMessage;
::RegisterHotKey( Handle, DEF_VK_LEFT , 0, VK_LEFT );
::RegisterHotKey( Handle, DEF_VK_RIGHT, 0, VK_RIGHT);
::RegisterHotKey( Handle, DEF_VK_UP , 0, VK_UP );
::RegisterHotKey( Handle, DEF_VK_DOWN , 0, VK_DOWN );
}
//---------------------------------------------------------------------------
void __fastcall TFrmMain::OnAppMessage( tagMSG &msg, bool &bHandled ) // <===== 요함수 안에서 뭔가를 해
// 줘야 할듯 한데 그걸 모르겠네요
{
if( msg.message == WM_HOTKEY ) // 사용자 정의 핫키 처리부
{
if (IsActive)
{
switch( msg.wParam )
{
case DEF_VK_LEFT : SelButton(5 );break ;
case DEF_VK_RIGHT : SelButton(6 );break ;
case DEF_VK_UP : SelButton(7 );break ;
case DEF_VK_DOWN : SelButton(8 );break ;
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall TFrmMain::FormClose(TObject *Sender, TCloseAction &Action)
{
::UnregisterHotKey( Handle, DEF_VK_LEFT );
::UnregisterHotKey( Handle, DEF_VK_RIGHT);
::UnregisterHotKey( Handle, DEF_VK_UP );
::UnregisterHotKey( Handle, DEF_VK_DOWN );
}
void __fastcall TFrmMain::FormActivate(TObject *Sender)
{
IsActive = true ;
}
void __fastcall TFrmMain::FormDeactivate(TObject *Sender)
{
IsActive = false ;
}
|