473,804 Members | 3,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how catch combination of key??

Hi,

I am working on SDI base application using vs2k5. I need to perform
some task on combination of keys (link ctrl+v). I wrote WM_KEYDOWN
message in my view for control command keys (like Delete, Insert, etc)
but unable to catch combination of keys in WM_KEYDOWN message. I tried
to use GetKeyStatus function in WM_KEYDOWN message but not gets any
positive results. Please guide me, how I can control combination of
keys in WM_KEYDOWN message, like, if I wants to perform some task on
ctrl+v for this, what I do for it??

Regards,

-aims

Apr 9 '07 #1
13 2601
>I am working on SDI base application using vs2k5. I need to perform
>some task on combination of keys (link ctrl+v). I wrote WM_KEYDOWN
message in my view for control command keys (like Delete, Insert, etc)
but unable to catch combination of keys in WM_KEYDOWN message.
For the situation you mentioned you'd normally create an accelerator
entry for the key combination in the application's resource.

Dave
Apr 9 '07 #2

"David Lowndes" <Da****@example .invalidwrote in message
news:3u******** *************** *********@4ax.c om...
I am working on SDI base application using vs2k5. I need to perform
some task on combination of keys (link ctrl+v). I wrote WM_KEYDOWN
message in my view for control command keys (like Delete, Insert, etc)
but unable to catch combination of keys in WM_KEYDOWN message.

For the situation you mentioned you'd normally create an accelerator
entry for the key combination in the application's resource.
And be sure to call TranslateMessag e from your message loop.
>
Dave

Apr 9 '07 #3
For the situation you mentioned you'd normally create an accelerator
entry for the key combination in the application's resource.
It will not work for me because I need to perform some actions on ctrl
+v. I tried following code in WM_KEYDOWN which work on ctrl+shift+v
but not working on ctrl+v.

if(nChar == 'V' && (0x8000 & GetKeyState(VK_ CONTROL)))
{
//do some thing
...
}

can you please guide me how i can fix this problem??

Regards,
-aims

Apr 9 '07 #4
>For the situation you mentioned you'd normally create an accelerator
>entry for the key combination in the application's resource.

It will not work for me because I need to perform some actions on ctrl
+v.
What do you mean? That's what accelerators are intended for.
>I tried following code in WM_KEYDOWN which work on ctrl+shift+v
but not working on ctrl+v.

if(nChar == 'V' && (0x8000 & GetKeyState(VK_ CONTROL)))
{
//do some thing
...
}
I can't see any apparent reason why that shouldn't work - what code do
you have for the Ctrl+Shift+V case?

Dave
Apr 9 '07 #5
if(nChar == 'V' && (0x8000 & GetKeyState(VK_ CONTROL)))
{
//do some thing
...
}
Hi Dave!

This code works when I removed all combination related to Ctrl and
Shift keys from Accelerated. The following entries was in my
accelerated file.
Shift+Insert
Ctrl+C
Ctrl+X
But I am not able to understand why it was not working. I was trying
to control Ctrl+V key combination which was not in my accelerated keys
list. Accelerated key has high priority and then pass to messages??

Apr 10 '07 #6
>if(nChar == 'V' && (0x8000 & GetKeyState(VK_ CONTROL)))
>{
//do some thing
...
}

Hi Dave!

This code works when I removed all combination related to Ctrl and
Shift keys from Accelerated.
Can you explain in more detail what you removed?
>The following entries was in my
accelerated file.
Shift+Insert
Ctrl+C
Ctrl+X
By "accelerate d file", do you mean the accelerator table resource for
your application - or something else?
>But I am not able to understand why it was not working. I was trying
to control Ctrl+V key combination which was not in my accelerated keys
list.
Which (and what type of) window are you trying to catch these
accelerator key combinations for?

Dave
Apr 10 '07 #7
Dave,
Can you explain in more detail what you removed?
I was making SDI base application and by that time following
information I seen, which includes Ctrl+V as well.

IDR_MAINFRAME ACCELERATORS
BEGIN
"N", ID_FILE_NEW, VIRTKEY,CONTROL
"O", ID_FILE_OPEN, VIRTKEY,CONTROL
"S", ID_FILE_SAVE, VIRTKEY,CONTROL
"P", ID_FILE_PRINT, VIRTKEY,CONTROL
"Z", ID_EDIT_UNDO, VIRTKEY,CONTROL
"X", ID_EDIT_CUT, VIRTKEY,CONTROL
"C", ID_EDIT_COPY, VIRTKEY,CONTROL
"V", ID_EDIT_PASTE, VIRTKEY,CONTROL
VK_BACK, ID_EDIT_UNDO, VIRTKEY,ALT
VK_DELETE, ID_EDIT_CUT, VIRTKEY,SHIFT
VK_INSERT, ID_EDIT_COPY, VIRTKEY,CONTROL
VK_INSERT, ID_EDIT_PASTE, VIRTKEY,SHIFT
VK_F6, ID_NEXT_PANE, VIRTKEY
VK_F6, ID_PREV_PANE, VIRTKEY,SHIFT
END

After that I was removed ID_EDIT_PASTE resource ID from accelerator
table and try to capture Ctrl+V by code but it was not working.. One
by One I removed all entries from accelerator but WM_KEYDOWN message
start working on when no entry left in accelerator table..
By "accelerate d file", do you mean the accelerator table resource for
your application - or something else?
I wrote "accelerato r file" by mistaken that is accelerator table..

Regards,
-aims

Apr 10 '07 #8
>Can you explain in more detail what you removed?
>
I was making SDI base application and by that time following
information I seen, which includes Ctrl+V as well.

IDR_MAINFRAM E ACCELERATORS
BEGIN
...
END

After that I was removed ID_EDIT_PASTE resource ID from accelerator
table and try to capture Ctrl+V by code but it was not working.
OK, I just wanted to be clear that it was the resource accelerator
table you were referring to.
>One
by One I removed all entries from accelerator but WM_KEYDOWN message
start working on when no entry left in accelerator table.
I don't immediately know why that should be - are you saying that you
don't receive *any* WM_KEYDOWN messages, or just the ones that had
accelerators defined?

Why do you want to do the key detection in code rather than relying on
the existing accelerator & command messages they will create?

Dave
Apr 10 '07 #9
I don't immediately know why that should be - are you saying that you
don't receive *any* WM_KEYDOWN messages, or just the ones that had
accelerators defined?

Why do you want to do the key detection in code rather than relying on
the existing accelerator & command messages they will create?
some how accelerators was not working.. thats why, i was write
WM_KEYDOWN message..

Regards,
-aims

Apr 15 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
6009
by: Noor | last post by:
please tell the technique of centralize exception handling without try catch blocks in c#.
1
3978
by: Bo Xu | last post by:
Object of Combination By Bo Xu Introduction A combination of n things, taken s at a time, often referred as an s-combination out of n, is a way to select a subset of size s from a given set of size n. There are n!/(s!(n-s)!) ways to do this. Donald E. Knuth gives several methods (algorithms) to generate all the s-combinations in . In such procedure-oriented way, each s-combination is processed while it's being generated. In some
3
1940
by: John | last post by:
Hi, I have to catch the "back" browser's functionality from the menu. I already can catch the key-stroke combination for IE + NS/Firefox and inactivate the mouse right-button, but I still have to catch the event of the browser's "back" functionality from the menu bar. Does anybody have an idea how can I catch this with JavaScript? Thank you very much for your answerz John
4
3025
by: lauch2 | last post by:
In a default MFC - dialog based application (VC6.0 or VC7.1), the following try-catch code does not be catched in Release mode, but it is OK for Debug mode. Any compiler/link option is required to turn on or turn off? try { int *i = 0; *i = 0; } catch(...)
10
5569
by: mttc | last post by:
I read articles that suggest preventing delete by throwing Exception from RowDeleting Event. I not understand where I can catch this Error?
2
1185
by: Matthew | last post by:
I want to create a program that runs in the system tray and watches for key combinations (Ctrl. + Shift + 1, for example) and performs an action associated with that combination. The catch is there is another program will have focus when those keys will be pressed, and needs to keep focus. Can this be accomplished? Matthew
6
4522
by: aka_eu | last post by:
I have this problem. I'm trying to get all the valid combination C(N,K) that pass one condition. For example C(5,3) can use in any combination this numbers {1,2,3,4,5} But let's say that I have the limitations that these pair of numbers cannot be part of the same combination {2,3} and {4,5}
2
21397
by: calderara | last post by:
Dear all, What is the best way to catch the user prressig the CTRL- C key combination.. I have try the keypress ans key down event but I am able only to catch one key at a time .. Amy idea ? regard serge
12
1943
by: reycri | last post by:
While the following is allowed: if (a == b) SomeFunction(); else OtherFunction(); The following is not: try
0
10578
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9152
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.