Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling Ctrl+N in browser

Status
Not open for further replies.

datapath

Programmer
Feb 20, 2003
11
0
0
BR
Hi,
I am working on a program that uses the browser control.
When the user holds Ctrl+N, a new internet explorer
browser opens. How can I avoid this? I don't want to
let the user have another web browser.
Thanks.
 
Try to set the form KeyPreview property to true and use the FormKeyPress event to catch the ctrl-N event

void __fastcall TForm1::FormKeyPress(TObject *Sender, char &Key) {
if( Key == '\x0E' ) {
Key = 0;
}
}
 
Its not working. I think I have to use FormKeyDown to
catch ctrl+n, and I have already set
keypreview to true but cant catch anything!

 
You are correct in that to catch a combination of keys, you have to use FormKeyDown. Have you tried this in that section of code?
Code:
if (Shift.Contains(ssCtrl) && Key == 'N')
{
    // do something
}
James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.
[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
Yes, I tried it.
The problem is that there is a button and a browser in the
window of my application. If the button has the focus, it
works, the event is caught. If the browser has the focus
the event is not caught and a new window of internet
explorer is opened.
Didn't find a solution yet...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top