Click to See Complete Forum and Search --> : HotKey


srini_raghav
June 4th, 1999, 04:25 AM
Hi,
I want to put a HotKey to my application means, it should open my application window which will be minimized... Means that If I am working with some other application and If I press that Hotkey I should be able to trap that hotkey and open my application... how can I do this..
Thanks lot,
Srini

June 5th, 1999, 12:11 AM
see registerhotkey in msdn

srini_raghav
June 5th, 1999, 06:53 AM
I wrote the code like this... I don't get where the problem is. Still unable to solve the problem.Thanks lot for ur answer and solution. The code is

int a = (int)GlobalAddAtom("Tasksrini");
d = GetLastError();
if (RegisterHotKey((HWND)this,a,MOD_ALT|MOD_CONTROL ,30) == 0)
{
d = GetLastError();
AfxMessageBox("hello wrong");



Can u please let me know where I am doing some mistake?
Thanks lot,
Srini

Daniel Levine
June 5th, 1999, 10:36 AM
Hi,

If the problem is that the actual RegisterHotKey call returns zero, it probably means that the hotkey you chose is already in use. If the problem is that nothing happens when you press the hotkey, that is because your window must handle the WM_HOTKEY message.

Daniel.

Walter I An
June 6th, 1999, 01:33 PM
I did use hotkey as following:

SendMessage(WM_SETHOTKEY,(WPARAM)MAKEWORD(VK_F12,HOTKEYF_CONTROL|HOTKEYF_SHIFT));

U get hotkey message thru WM_SYSCOMMAND
so overide that message and check for
SC_HOTKEY and then do appropriate stuff.

It worked for my app.
Let me know whether it works for U.

Hope for help. :)

Walter

srini_raghav
June 7th, 1999, 09:08 AM
Hi,
Thanks a lot and lot. Finally problem got solved. It is working fine now.... The problem is, the first parameter I gave this, insteaf I gave m_hWnd... It works fine...
Thanks lot,
srini