How to trap key combination in Windows message loop?

I need to trap "Ctrl+1 " key combination in Windows message loop
and send it to an HTML page to trigger some action.

This is what I am doing:
----------

In Visual C++ application's windows message loop:
-------------------

PreTranslateMessage(&msg);

HTML Code
-----
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">

function ctrlKeyUp()
{

if (window.event.ctrlKey) {

if (window.event.keyCode == 49) alert('Ctrl and 1 pressed');

}

}



</SCRIPT>

</HEAD>

<BODY onKeyup="ctrlKeyUp()">

<h2>Key Pressing</h2>
Test again :
Use control and Key.

</BODY>
</HTML>

The Problem:
------
In my HTML code the value of key trapped is for the key "1".
[994 byte] By [ru_2006] at [2007-11-20 1:37:27]
# 1 Re: How to trap key combination in Windows message loop?
Not sure what you mean by "trap" here... You mean, you want to handle that keyboard message? Also, I don't understand the statement "send it to an HTML page"... Are you dynamically creating HTML with embedded JavaScript? And, anyways, is your question about Visual C++, or about JavaScript? :confused:
gstercken at 2007-11-10 23:17:47 >
# 2 Re: How to trap key combination in Windows message loop?
You are right. I want to handle that keyboard message.

I am trying to Simulate a ctrl+1 keystroke
keybd_event(VK_CONTROL,NULL, KEYEVENTF_KEYUP,0); // control Release
keybd_event(0x31,NULL,KEYEVENTF_KEYUP,0); // 1 Release
preTrasnslateMessage(&msg);

The problem is about Visual C++. Or may be I am doing something wrong in the Javascript.

About the HTML page. This HTML is not dynamically created. The system is trying to load the stored HTML file which has the java script.

Thanks.
ru_2006 at 2007-11-10 23:18:47 >