
Who cares about the content?
Moderators: Hacker, petermad, Stefan2, white
Certainly not - in Russian environment. To use your methode with Russian Windows it is necessary to press: Alt+Space, Ctrl+Shift (to switch the keyboard layout; Alt+Shift alternatively), then Alt+P (the Russian key for closing is located there).roentgen666 wrote:We should have a contest... you will lose with such method for sure
Changing the content is not a problem. If you wish to change it - you just change it, and it becomes changed.Lefteous wrote:Quite funny to see people discussing about how to _close_ the help file. This seems to be the number one use case of the help file
Who cares about the content?
You know what I mean.Lefteous wrote:Yes of course - I'm the help file author
Changing the html help engine is not a problem. If you wish to change it - you just change it, and it becomes changed. Just write a letter to steve@microsoft.comYou know what I mean.
Code: Select all
IntPtr m_hhook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHook, instanceOfModule, 0);
int KeyboardHook(int code, IntPtr wParam, IntPtr lParam)
{
if (code < 0)
return CallNextHookEx(m_hhook, code, wParam, lParam);
CloseChmIfActive(lParam);
// Yield to the next hook in the chain
return CallNextHookEx(m_hhook, code, wParam, lParam);
}
void CloseChmIfActive(IntPtr lParam)
{
KBDLLHOOKSTRUCT kbdStruct = (KBDLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(KBDLLHOOKSTRUCT));
if (kbdStruct.vkCode == 27) // Esc
{
FindAndCloseHelpForm();
}
}
void FindAndCloseHelpForm()
{
int handle = FindWindow("HH Parent", "Total Commander");
if (handle == 0) return false;
int foregroundHandle = GetForegroundWindow();
if (handle == foregroundHandle)
{
// Post a message to Application to end its existence.
Win32.SendMessage(handle, WM_SYSCOMMAND, SC_CLOSE, 0);
}
}